PhilipsHue / PhilipsHueSDK-iOS-OSX

The Software Development Kit for Philips Hue on iOS and OS X (beta)
579 stars 169 forks source link

Stange bug with Notifications after PushLinking #18

Closed twam closed 10 years ago

twam commented 11 years ago

I implemented PushLinking very similar to the sample App:

To start PushLinking it instantiate a controller from my Storyboard with [self presentViewController:pushLinkAuthentificationNavigationViewController animated:YES completion:NO];

The controller itself work's as the one in the sample App displaying a progress bar. When I do not push the button within the 30 seconds, the authenticationFailed routine get's called

- (void)authenticationFailed {
    // Deregister for all notifications
    [[PHNotificationManager defaultManager] deregisterObjectForAllNotifications:self];

    // Inform delegate
    [_delegate pushlinkFailed:[PHError errorWithDomain:SDK_ERROR_DOMAIN code:PUSHLINK_TIME_LIMIT_REACHED userInfo:[NSDictionary dictionaryWithObject:@"Authentication failed: time limit reached." forKey:NSLocalizedDescriptionKey]]];
}

which itself calls succesfully the pushlinkFailed function on the delegate

- (void)pushlinkFailed:(PHError *)error {
    // remove push link view controller
    [self dismissViewControllerAnimated:YES completion:NO];
}

At that moment the app crashes with

2013-03-31 19:13:47.484 Hue Controller[3941:c07] -[PHCompleteBridgeParser1 noLocalConnectionNotificationReceiver]: unrecognized selector sent to instance 0x761a8f0
2013-03-31 19:13:47.484 Hue Controller[3941:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PHCompleteBridgeParser1 noLocalConnectionNotificationReceiver]: unrecognized selector sent to instance 0x761a8f0'

where the class PHCompleteBridgeParser1 is random.

This even happens when I never register any notification handler for NO_LOCAL_CONNECTION_NOTIFICATION in any class. The only thing that works is not to dismiss the ViewController. But when I write a small test-function for the NO_LOCAL_CONNECTION_NOTIFICATION within that class, it never get's called.

I don't understand what's going wrong here. Any hints appreciated.

jhvdb87 commented 10 years ago

Can't reproduce this with the latest version, can you verify ?

BhavyaMihira09 commented 10 years ago

@twam I see a similar crash.How did you fix it?

BhavyaMihira09 commented 10 years ago

@twam I see a similar crash.How did you fix it?

twam commented 10 years ago

I totally rewrote that code and I happened not anymore. Still no clue wat the problem was.