0

I have used appgroup for sending data between a watch app and an iphone app but I am not able send data back from the watchapp to the iphone app. This problem resides in the watch OS.

My code is:

@implementation InterfaceController

@synthesize MedText,MedImage,selImage;
- (void)awakeWithContext:(id)context {
    [super awakeWithContext:context];

    // Configure interface objects here.
    // Configure interface objects here.

    NSUserDefaults *userDefaultVIT=[[NSUserDefaults alloc] initWithSuiteName:@"group.Medapp"];

    [userDefaultVIT synchronize];
    NSString *str= [userDefaultVIT stringForKey:@"MedOrgWatchVIT"];
    MedText.text=str;
    NSLog(@"%@",str);
    i=0;
    MedArr=[[NSArray alloc] init];
    MedImageArr=[[NSArray alloc] init];
}
Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123

1 Answers1

0

You can't use AppGroup to share data between iOS and WatchApp. Only WatchOS1 App can do that since WatchOS 2 App runs on Watch itself.

AppGroup for WatchOS2 means that shared container that lies on Watch for several watch apps that are provided by same vender.

You should have to use Watch Connectivity Framework to synchronize your data between iOS App and WatchOS2 App.

jeeeyul
  • 3,727
  • 1
  • 24
  • 37