2015-09-07 28 views
0

我已經使用appgroup在手錶應用程序和iphone應用程序之間發送數據,但我無法將數據從watchapp發送回iphone應用程序。此問題駐留在手錶操作系統中。當我在手錶中使用應用程序組時,無法將數據從手錶應用程序發送到手機os1

我的代碼是:

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

回答

0

不能使用AppGroup分享iOS和WatchApp之間的數據。只有WatchOS1應用程序可以做到這一點,因爲WatchOS 2應用程序在Watch上運行。

用於WatchOS2的AppGroup表示位於Watch上的共享容器,用於監視由同一供應商提供的多個手錶應用程序。

您應該必須使用Watch Connectivity Framework才能在iOS應用和WatchOS2應用之間同步數據。

相關問題