I can't get the shared NSUserDefaults to work with WatchKit and my host app!

Hi, i am having a hard time with user defaults atm, situation is the following...

I am using xcode 7 beta( 7A121l) and i used the template for an ios app with an watchkit app together

I let xcode set up the provisioning profiles and set up an app group and added all the apps to it..

What i tried was putting stuff (string) in the userdefaults, and getting it out again from the watchkit app extension to display it in the ui of the watch app,

i tried i failed.. after a few hours and out of pure frustration i added a today extension target and also added that to the app group, and automagically it worked :-O

So my setup is the following:


ios app, watchkit app, watchkit app extension - everyone with a own provisioning profile (ofc they share one prefix)

i got the setting right, in capabilies and i checked the plist's also for xcode fuckups, and it works on today extension


i set up the userdefaults with "initWithSuite:"


but i dont even get the same container URL on the watch simulator and the ios app simulator.. i tried it on the device and on the siulator already

(installed ios9 and watchOS 2 for that reason, maybe thats a problem?)


Any of you guys have an idea whats going on here?

I will get crazy soon :-D (*crazy laugh*)


greetz from vienna


PS: let me know if you are missing information that you need to help me :-)

NSUserDefault, using shared groups are no longer supported with iOS 9 and watchOS 2 since the watch extension is now running on the watch itself instead of on iOS. You'll need to take a look at the WatchConnectivity Framework if you want communication between watchOS 2 and iOS 9.


Here is the framework reference: https://developer.apple.com/library/prerelease/ios/documentation/WatchConnectivity/Reference/WatchConnectivity_framework/index.html


Also take a look a the lister sample code here:

https://developer.apple.com/library/prerelease/ios/samplecode/Lister/Introduction/Intro.html#//apple_ref/doc/uid/TP40014701

Do you have any sources on that? I am running into the same issue as schusterlich, but according to the thread: https://forums.developer.apple.com/thread/5567 "Apps built for watchOS 1 are compatable with a watchOS 2 device". A user also reports that App Groups and NSUserDefaults works fine for him on the watchOS 2 simulator. Not sure what to make of it.

I can't get the shared NSUserDefaults to work with WatchKit and my host app!
 
 
Q