ios - iPhone and Apple Watch not sharing App Group -


i've been pulling hair out on problem 2 days now. generate small movie file in iphone app want send iphone play on apple watch. proof of concept, put similar .mov in bundle of apple watch app , able play no problems. figured, easy peasy, when want send new little clip watch, put in app group shared container , access there instead of bundle. nope!

i have been through tons of s.o. posts, tried many different approaches , nothing works expected.

before ask, have re-done app group several times, deleted old ones itunes connect, re-generated provisioning profiles, cleaned targets numerous times, deleted deriveddata several times, deleted apps , started on several times , tried virtually every little tweak , fix find on s.o. nothing helps.

i think know problem is, have no idea how conquer it.

here code use in both iphone app , watch app path shared container (this snippet if watch side):

let filemanager = filemanager.default     let sharedcontainer = filemanager         .containerurl(             forsecurityapplicationgroupidentifier: "group.com.mycompany.myappname")      let dirpath = sharedcontainer?.path      sharedfilepathonwatch = (dirpath! nsstring).appendingpathcomponent("watchpreview.mov")      print ("shared file path on watch: \(sharedfilepathonwatch)")     print ("shared file path iphone: \(sharedfilepath)") 

the print statements show me shared file path send on watch iphone (via watch connectivity) , shared path watch app resolves.

what when runs following:

shared file path on watch: /private/var/mobile/containers/shared/appgroup/94aa7797-528d-4e96-9623-23285be0742b/watchpreview.mov

shared file path iphone: /private/var/mobile/containers/shared/appgroup/4d43c314-ccbd-4861-bf90-69a8ac71198c/watchpreview.mov

now expecting there 1 shared container , both iphone , watch should resolve same path, not case. i've noticed these paths remain constant 2 apps on multiple runs. it's not dynamic address changing every time run suspected awhile.

as last ditch attempt function, figured since had path shared container on iphone , shared container on apple watch, maybe move file 1 other because, well, supposed sharing. no, doesn't work.

so big questions are:

  1. why resolve 2 different paths on shared apps
  2. how heck little movie file iphone apple watch

with introduction of watchos2 , native watchos apps, apple watch apps no longer extensions of ios counterpart , hence don't share appgroups.

you cannot use appgroups sharing data watchos2 onwards. have use watchconnectivity framework sending data between ios , watchos apps.

see watchkit programming guide - sharing data page more information on topic.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -