1

Refer to this article: http://www.glimsoft.com/06/28/ios-8-today-extension-tutorial/. I did a Today extension can share data with containing app.

But when I move the same code into my Custom Keyboard extension, My custom keyboard never read data from containing app NSUserDefaults file.

I want to know if ios8 don't allow Keyboard extension sharing data with containing app?

xcode 6 (beta5) + ios8 beta5

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Rick Wu
  • 61
  • 1
  • 4
  • I double check apple article: https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html#//apple_ref/doc/uid/TP40014214-CH16-SW1 ios8 default don't allow this. It is only set RequestsOpenAccess with YES. But I think RequestsOpenAccess will cause customer think my custom keyboard have big risk. – Rick Wu Aug 23 '14 at 05:57

1 Answers1

1

Containing app and extensions are considered as different apps. You can use:

NSUserDefaults *ud = [[NSUserDefaults alloc] initWithSuiteName:@"com.yourname.yourapp"];

To sync data between app and extension.

Ethan Long
  • 745
  • 1
  • 6
  • 15
  • @JaredEgan You have to set `RequestsOpenAccess` to `YES` in your `info.plist` – Andrew Sep 21 '14 at 03:27
  • @JaredEgan I suppose you have resolved it, but again this is the correct way to do and it does work, only that you need to enable "Allow Full Access". My custom keyboard is working fine. – Evan Chu Sep 24 '14 at 18:43
  • I do experience cannot sync issue but disable and enable again "allow full access" seems solve the issue for debug versions. I hope release issue do not have this kind of bugs... – Ethan Long Sep 25 '14 at 08:37