如何使用 Objective-C 从我的 iPhone 向 Apple Watch 发送数组?

How can I send an array to the Apple Watch from my iPhone with Objective-C?

我正在尝试在 App Delegate 中使用以下方法将数组发送到 InterfaceController:

- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply
{
NSLog(@"Request received by iOS app");

NSMutableArray *mutableArray = [[NSMutableArray alloc] initWithCapacity:20];

for (NSDictionary *object in [[NSUserDefaults standardUserDefaults] objectForKey:@"reminders"]) {

    NSString *subject = object[@"subject"];
    [mutableArray addObject:subject];
}

NSLog(@"MUTABLE ARRAY: %@", mutableArray);

NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:mutableArray, @"key", nil];


reply(dictionary);
}

在界面控制器中:

- (IBAction)callPhoneAppButtonTapped
{
NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:@"text to display", @"key", nil];


[InterfaceController openParentApplication:dictionary reply:^(NSDictionary *replyInfo, NSError *error) {

 NSLog(@"Reply received by Watch app: %@", replyInfo);


}];
}

问题是我可以在 App Delegate 中看到数组,但我无法在 Apple Watch 的 InterfaceController 中读取回复?

关于此方法的任何建议或将数组发送到 InterfaceController 以创建 Table 的更好方法?

在 watchOS2 中,他们引入了一个很好的功能,称为 WatchConnectivity。请看我对这个问题的回复:

发送数组比String/NSNumber更容易。