Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

iOS Module NSNotification crashes the app

$
0
0

We have an iOS module and the intra-modular communication through the [NSNotificationCenter default] is crashing the Appcelerator app.

This happens when an event in ComExampleView.m needs to be communicated to the Appcelerator app. Because ComExampleView.m, a subclass of TiUIView, does not support fireEvent in itself, we need to communicate the event to ComExampleModule.m first.

We do this by:

1) in ComExampleModule.m

- (void) startup {
    [[NSNotificationCenter defaultCenter] addObserver:self
                 selector:@selector(handleEventA:)
                 name:@"eventA"
                 object:nil];
}
 
- (void) handleEventA : (id) args { //<-- this method is never entered.
    [self fireEvent:@"eventA" withObject:args];
}
2) in ComExampleView.m
- (void) someMethodTriggeredOnUserInteraction {
    [[NSNotificationCenter defaultCenter] postNotificationName:@"eventA" 
        object:nil]; //<-- app crashes right here.
}
We have tested our code inside an Xcode project and all the notifications work as desired. It is only when integrating with an Appcelerator mobile project that problems arise.

We would appreciate any ideas to work around this / understand this issue better.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>