Posts

Post not yet marked as solved
1 Replies
1.4k Views
I am trying to add App Icons to my WatchOS app but need to do this in the Info.plist as I am building the project through the NativeScript CLI.I have all the watch icons stored in AppIcon.appiconset inside Images.xcassets. I am unsure of how to do this and have looked around but found no solution, any help is greatly appreciated!
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.4k Views
I am looking to extend the expiry time of an access token by refreshing the token in the background. The expiry time is currently set to 30 minutes (server side) and this value is not to be changed, the idea is that every 29 minutes I will call a method that refreshes the access token to keep it alive for a further 1 and a half hours (meaning the access token stays alive for almost 2 hours). I have read that background tasks should take up to 5 second to complete then if more time is required to use UIKit, although this will only allow a further few minutes to complete the tasks needed.Are there any special circumstances that will allow me to do this in background, or is there a better way to do this? Thank you for any help!
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.1k Views
I am trying to send data from my iOS app to a companion WatchOS app using WCSession. The iOS app was created with NativeScript, thus the need for Objective-C.When running the apps on both simulators and real devices I receive the following error message: "[WC] WCSession is missing its delegate"iOS Objective-C Code (This is being called in Typescript):#import "SendToWatch.h" #import @interface SendToWatch () @end @implementation SendToWatch - (void)sendData: (double)value { if (WCSession.isSupported) { WCSession *session = [WCSession defaultSession]; session.delegate = self; [session activateSession]; NSError *error = nil; NSDictionary *applicationDict = @{@"data":[NSString stringWithFormat:@"%0.2f", value]}; [session updateApplicationContext:applicationDict error:nil]; if (error) { NSLog(@"%@", error.localizedDescription); } } } //MARK: - WCSessionDelegate - (void)session:(WCSession *)session activationDidCompleteWithState:(WCSessionActivationState)activationState error:(NSError *)error { } - (void)sessionDidBecomeInactive:(WCSession *)session { NSLog(@"Session Did Become Inactive"); } - (void)sessionDidDeactivate:(WCSession *)session { NSLog(@"-- Session Did Deactivate --"); [session activateSession]; } @endWatchOS (InterfaceController.m):#import "InterfaceController.h" #import @interface InterfaceController () @end @implementation InterfaceController - (void)awakeWithContext:(id)context { [super awakeWithContext:context]; // Creates a WCSession to allow iPhone connectivity if ([WCSession isSupported]) { WCSession *session = [WCSession defaultSession]; session.delegate = self; [session activateSession]; NSLog(@"-- WCSession Active --"); } } - (void)willActivate { [super willActivate]; NSLog(@"-- Controller Activated --"); } - (void)didDeactivate { [super didDeactivate]; NSLog(@"-- Controller Deactive --"); } //MARK: - WCSessionDelegate // Receieves the data sent from the iPhone app - (void)session:(nonnull WCSession *)session didReceiveApplicationContext:(nonnull NSDictionary *)applicationContext { NSString *receivedData = [applicationContext objectForKey:@"data"]; NSLog(@"-- APPLICATION CONTEXT RECEIVED --"); NSLog(@"-- Received from iOS App: %@", applicationContext); dispatch_async(dispatch_get_main_queue(), ^{ [self.dataLabel setText:receivedData]; NSLog(@"-- DATA UPDATED --"); }); } - (void)session:(WCSession *)session activationDidCompleteWithState:(WCSessionActivationState)activationState error:(NSError *)error { } @end
Posted Last updated
.