Hello,
I noticed something weird. In iOS, the method application:handleWatchKitExtensionRequest (for the Apple Watch) launches the game in background.
I know the Watchkit extension is supposed to communicate with the iPhone, but is it supposed to like “launch” the game? Because right now what happens is that as soon as this method is called, the game runs. I have my logs from my home scene and stuff happening, just without the app opened.
Then if I go in my app I have some errors (due tu network download that didn’t work during this time), and I don’t think Apple accept apps behaving like this.
Is this normal? Is there something special to do so that my calls to this method won’t launch the whole game?
Thanks
I just added this code in the AppCoronaDelegate:
- (void)application:(UIApplication \*)application handleWatchKitExtensionRequest:(NSDictionary \*)userInfo reply:(void(^)(NSDictionary \*replyInfo))reply { NSLog(@"%s", "[MQD] RECEIVED APPLE WATCH REQUEST"); NSError \*error; NSArray \*paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString \*documentsDirectory = [paths objectAtIndex:0]; NSString \*filePath = [documentsDirectory stringByAppendingPathComponent:@"player\_profile.json"]; NSFileManager \*fileManager = [NSFileManager defaultManager]; if ([fileManager fileExistsAtPath:filePath] == NO){ printf("[MQD] FILE DOESN'T EXIST"); reply(@{@"tmtc":@"fail"}); } else { NSLog(@"%s", "[MQD] File exists"); NSLog(@"%@", filePath); NSString \*fileContent = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil]; // NSString \*fileContent = [[NSString alloc] initWithContentsOfFile:filePath encoding:NSUTF8StringEncoding]; NSLog(@"%@", fileContent); printf("[MQD] ALLO"); reply(@{@"tmtc":fileContent}); } }