1

I have enabled app groups in my iOS app and watchkit app. My provisioning profile is also managed by XCode. The both apps iOS app and WatchKit App runs fine.

When I try to access the path of shared container from iOS app and watchkit extension using following statement, I get different paths.

let directory: NSURL = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier("group.com.myapp")

Does anyone have any idea, what I am doing wrong here?

Viktor Varsano
  • 110
  • 1
  • 1
  • 10
Lokireddy
  • 11
  • 3
  • I haven't have _that_ much experience with app groups. I've only worked with them in a today extension. But I'm pretty sure _different devices_ can't share the same file path... – Sweeper Feb 04 '20 at 13:22
  • In this case, the watch app is an extension of iOS app. Both of these apps should have a shared container/folder to share data. And this shared container was supposed to be accessible through this swift statement NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier("group.com.myapp") – Lokireddy Feb 04 '20 at 15:19
  • @Lokireddy did you figure this out? – spartygw Apr 28 '22 at 15:29
  • My understanding seems to be wrong here. The watch app extension and the iOS cannot have same container even if it is through app groups or shared container. My main intention of achieving this was to share files. To share files from iOS app to WatchKit app there is different methods in watch connectivity. – Lokireddy Jan 02 '23 at 20:38

0 Answers0