Today App Extension Widget Tap To Open Containing App

EDIT: Ok, just a little correction here. I got it working with placing a button over the label just like suggested above and the following code: – (IBAction) goToApp: (id)sender { NSURL *url = [NSURL URLWithString:@”floblog://”]; [self.extensionContext openURL:url completionHandler:nil]; } I linked it to a “Touch Up Inside” event. However, this also causes the app … Read more

Sharing data between an iOS 8 share extension and main app

You should use NSUserDefaults like this: Save data: objc NSUserDefaults *shared = [[NSUserDefaults alloc] initWithSuiteName:@”group.yougroup”]; [shared setObject:object forKey:@”yourkey”]; [shared synchronize]; swift let defaults = UserDefaults(suiteName: “group.yourgroup”) defaults?.set(5.9, forKey: “yourKey”) Read data: objc NSUserDefaults *shared = [[NSUserDefaults alloc] initWithSuiteName:@”group.yougroup”]; id value = [shared valueForKey:@”yourkey”]; NSLog(@”%@”,value); swift let defaults = UserDefaults(suiteName: “group.yourgroup”) let x = defaults?.double(forKey: “yourKey”) … Read more

Today Extension Failed to inherit CoreMedia permissions from

I believe the “Failed to inherit CoreMedia permissions from NNNN” warning is related to App Groups when you are creating an App Extension. Both your containing application and your app extension need to have the App Groups capability turned ON and using the same app group container ID (example: group.com.yourdomain.yourappname). App Groups are used to … Read more

Sharing UserDefaults between extensions

You cannot use UserDefaults.standard to share data between a host app and its app extension. You instead have to create a shared container with UserDefaults(suiteName:) to share data. Even though an app extension bundle is nested within its containing app’s bundle, the running app extension and containing app have no direct access to each other’s … Read more

Communicating and persisting data between apps with App Groups

Another benefit to App Groups is the ability to share a NSUserDefaults database. This also works for App Extensions (notification center widgets, custom keyboards, etc). Initialize your NSUserDefaults object like this in all applications in the app group and they will share the database: Objective-C: [[NSUserDefaults alloc] initWithSuiteName:@”<group identifier>”]; Swift: NSUserDefaults(suiteName: “<group identifier>”) Keep in … Read more