0

我已经使用 appgroup 在手表应用程序和 iphone 应用程序之间发送数据,但我无法将数据从手表应用程序发送回 iphone 应用程序。此问题存在于手表操作系统中。

我的代码是:

@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];
}
4

1 回答 1

0

您不能使用 AppGroup 在 iOS 和 WatchApp 之间共享数据。只有 WatchOS1 App 可以做到这一点,因为 WatchOS 2 App 在 Watch 本身上运行。

AppGroup for WatchOS2 是指位于 Watch 上的共享容器,用于由同一供应商提供的多个手表应用程序。

您应该必须使用Watch Connectivity Framework在 iOS App 和 WatchOS2 App 之间同步您的数据。

于 2015-10-13T04:43:39.067 回答