【问题标题】:not able to send data from watch app to iphone when i used app groups in watch os1当我在手表 os1 中使用应用程序组时,无法将数据从手表应用程序发送到 iPhone
【发布时间】:2015-09-07 13:24:27
【问题描述】:

我使用 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];
}

【问题讨论】:

    标签: iphone ios8.1 watchos


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 2016-07-06
      • 1970-01-01
      • 2023-04-06
      • 1970-01-01
      • 1970-01-01
      • 2015-10-13
      • 1970-01-01
      • 1970-01-01
      • 2019-04-02
      相关资源
      最近更新 更多