As I am new for using Observer pattern. I am having application running well on iOS7 and lower versions.
I upgrated my application to iOS8 with XCode 6. When I open my application very first time in XCode 6 and run it, without showing any error message my application crash.
I tried by applying debugger and exception break point.
What I found is that my application is crashing at addObserver:
line code. What I am doing is:
- My application first opens login screen,
- User have to enter the username & password.
- If its new user then then logged in, and username & password is saved into database.
- Inside user is having option to update his password & save in DB.
Now when user logged in second time, my observer is not catching change in password.
Same line of code is working fine on lower version. I am doing something wrong? My code:
SqlLiteUser *userObj =(SqlLiteUser*)[objDAOFactory getUserDAO];
[userDAO addObserver:self forKeyPath:@"sendPasswordStatus" options:(NSKeyValueObservingOptionNew) context:@selector(handleSendPasswordResult:)];
[userDAO addObserver:self forKeyPath:@"noConnection" options:(NSKeyValueObservingOptionNew) context:@selector(noConnection)];