0

I want to share data between iphone app and watchapp,following code I have used to share data between them: //At iphone viewcontroller:

mydefaults=[[NSUserDefaults alloc]initWithSuiteName:@"group.sample.TodayExtensionSharingDefaults"];
[mydefaults synchronize];
NSString *msgStatus=[mydefaults objectForKey:@"msgStatus"];

//At iwatch side

appdefaults=[[NSUserDefaults alloc]initWithSuiteName:@"group.sample.TodayExtensionSharingDefaults"];
[appdefaults setObject:@"read" forKey:@"msgStatus"];
[appdefaults synchronize];

enter image description here

rmaddy
  • 314,917
  • 42
  • 532
  • 579

3 Answers3

1

I got it worked by following this video

https://www.youtube.com/watch?v=0ts196U4xS4

Are you sure that you have turned on 'App Groups' for both iPhone part & iwatchkit extension ? Also the app groups selected must be the same.

Alen Alexander
  • 725
  • 6
  • 22
0

My issue resolved by updating xcode to beta 6.2 version 5 and adding [WKInterfaceController openParentApplication:@{@"msgStatus": @"unread"} reply:nil]; at watchkit side which was mentioned in previous answer which is deleted now dnt knw why :-( ,but I want to thank him(I dnt remember that persons name). plz post dat answer again.

-1

Make sure that you are using the correct and the up to dated provisioning.

Tekaya Marouene
  • 620
  • 3
  • 14