Code Monkey home page Code Monkey logo

Comments (4)

hamin avatar hamin commented on July 21, 2024

@doctordbx @SunilSpaceo i'm using this lib in production, any ideas on a fix?

from skinputclass.

hamin avatar hamin commented on July 21, 2024

@doctordbx @SunilSpaceo I think the KVOBlock library you are using has an update for this Tricertops/Block-KVO@f4e5450 I'm gonna try this myself and see if it fixes my crashes

from skinputclass.

doctordbx avatar doctordbx commented on July 21, 2024

@hamin Let me know how you get on please.

from skinputclass.

hamin avatar hamin commented on July 21, 2024

@doctordbx @SunilSpaceo so I figured it out. It was an issue with that KVOBlock library. I was able to reproduce this bug very consistently:

  • Have Two fields, one UITextField and one SKDigitField
  • Tap on SKDigitField first
  • Dismiss your view controller
  • Launch transition to same view controller again
  • Tap on SKDigitField or the other UITextField
  • You get a BAD EX crash

Using the Zombies template in Xcode Instruments I noticed that there was a Zombie (object wasn't dealloced and was being sent a message).

The culprit is actually iMartinKiss's KVOBlock library.

From what I can tell SKInput is only using that library for one method, the removeAllObservations method.

This is actually not necessary and I don't quite see the point of using that lib for this class especially since there is no direct KVO manipulation going on. SKInput is subscribing to events via NSNotificationCenter.

My solution:

  • Comment out all occurences of removeAllObservations ( I found two [doneButton removeAllObservations] )
  • Add a dealloc method to properly remove observations
-(void)dealloc{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

Essentially I think you can remove KVOBlock library completely from SKInput since you're not really using any block handlers for direct KVO handling at all @SunilSpaceo

This solved my crashes :)

from skinputclass.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.