naSh naSh - 2 months ago 15
Objective-C Question

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

I am trying to send an array to the InterfaceController with the following method within the App Delegate:

- (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];


And in the Interface Controller:

- (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);


The problem is I can see the array in the App Delegate but I cannot read the reply in the InterfaceController of the Apple Watch?

Any suggestions on this approach or a better approach to send an array to the InterfaceController in order to create a Table?


In watchOS2 they introduces a nice feature called WatchConnectivity. Please look at my reply to this question: How to send data from Iphone to Apple Watch in OS2 in Objective-C

Its easy to send an array instead of String/NSNumber.