ios - WatchConnectivity session in more than one view controller -


i developing watch app using watchos 2 , parent app on ios 9 beta. using watchconnectivity sessions pass data apple watch iphone. need have session in 2 different view controller files, there problems start new wcsessions in each of view controllers , use them?

basically trying navigate 1 view controller other view controller using performseguewithidentifier, works fine when put in viewdidload, put inside session method, starts breaking, , suspecting has wcsessions.

following part of code in trying navigate:

- (void)session:(nonnull wcsession *)session didreceivemessage:(nonnull nsdictionary *)message replyhandler:(nonnull void (^)(nsdictionary * __nonnull replymessage))replyhandler {     nsstring *msg = [message objectforkey:@"msg"];     // nsdictionary* replyvalues =  @{@"session":@"established between phone   , watch"};     if ([msg isequaltostring:@"fromwatch"]) {         iswatch = true;         [self performseguewithidentifier: @"startdashboardsegue" sender: self];     }     // nsuserdefaults *prefs = [nsuserdefaults standarduserdefaults];     // [prefs setobject:messageflag forkey:@"messageflag"];      //replyhandler(replyvalues); } 

thanks!

the comment above wcsessiondelegate section in wcsession header states:

----------------------------- wcsessiondelegate -----------------------------

the session calls delegate methods when content received , session state changes. delegate methods called on same queue. delegate queue non-main serial queue. client's responsibility dispatch queue if neccessary.

so if want update ui (and using uikit) have dispatch main queue before invoking ui update methods.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -