ios - Forcing a saved image to sync with the iCloud Photo Stream -
i have app takes images periodically, , them uploaded icloud photo stream right after images taken.
it appears conditions need met in order work. seems work when running ios 8, device connected wireless, , using uiimagepickercontroller take pictures (rather avcapture) @ least once. seems uiimagepickercontroller when presented alters system settings allows subsequent automatic uploading of images icloud photo stream. if use avcapture take pictures, not work. i've confirmed "upload photo stream" enabled in icloud settings, , there active wireless connection.
here method used save image obtained uiimagepickercontroller:
- (void)saveimage : (uiimage *)image { // add image photo library [[phphotolibrary sharedphotolibrary] performchanges:^{ phassetchangerequest *assetchangerequest = [phassetchangerequest creationrequestforassetfromimage:image]; } completionhandler:^(bool success, nserror *error) { if (!success) nslog(@"error creating asset: %@", error); }]; }
when running on ipad ios 8, below entries see in device system logs:
oct 22 21:11:06 ipad mstreamd[14409] <notice>: (note ) ps: mspublisher - xxxxxxxx submitting 1 asset collections publication. oct 22 21:11:06 ipad mstreamd[14409] <notice>: (note ) ps: mspublisher - xxxxxxxx sending metadata... oct 22 21:11:10 ipad mstreamd[14409] <notice>: (note ) ps: mspublisher - xxxxxxxx uploading 1 assets... oct 22 21:11:11 ipad mstreamd[14409] <notice>: (note ) ps: received push notification invitations topic: com.apple.mediastream.subscription.push userinfo: { r = xxxxxxxx; } oct 22 21:11:11 ipad mstreamd[14409] <notice>: (note ) ps: <msiosmediastreamdaemon: 0x1662ad80>: push notification received photo stream targetpersonid xxxxxxxx. oct 22 21:11:12 ipad mstreamd[14409] <notice>: (note ) mstreamd: <mspowerbudget: 0x1666fae0>: plugged in external power. allowing file transfers. oct 22 21:11:12 ipad mstreamd[14409] <notice>: (note ) mstreamd: <mspowerbudget: 0x1666fae0>: push received. allowing file transfers continue 60.00 seconds oct 22 21:11:12 ipad mstreamd[14409] <notice>: (note ) ps: mspublisher - xxxxxxxx sending metadata... oct 22 21:11:12 ipad mstreamd[14409] <notice>: (note ) ps: mssubscriber - xxxxxxxx found 1 new asset collections. oct 22 21:11:13 ipad assetsd[11536] <warning>: unable open file save extended attributes (no such file or directory).
when running on iphone ios 9.1, have similar log entries, except have additional warnings/error messages caching server bolded:
oct 25 22:35:28 iphone mstreamd[1735] <notice>: (note ) ps: mspublisher - xxxxxxxx submitting 1 asset collections publication. oct 25 22:35:28 iphone mstreamd[1735] <notice>: (note ) ps: mspublisher - xxxxxxxx sending metadata... **oct 25 22:35:28 iphone assetcachelocatorservice[1658] <warning>: #df99fdd0 [i:assetcachelocatorservice.queue] found no caching servers** oct 25 22:35:28 iphone mstreamd[1735] <notice>: (note ) ps: mspublisher - xxxxxxxx uploading 1 assets... **oct 25 22:35:28 iphone mstreamd[1735] <notice>: (error) mmcs: __mmcs_proxy_locator_exists_block_invoke:167 might have caching server returned error: error domain=nsposixerrordomain code=60 "operation timed out" userinfo={com.apple.assetcachelocator.tag=#1963bd2d, nslocalizeddescription=quick miss requested}** **oct 25 22:35:29 iphone mstreamd[1735] <notice>: (note ) ps: mspublisher - xxxxxxxx sending metadata...** oct 25 22:35:29 iphone mstreamd[1735] <notice>: (note ) ps: received push notification invitations topic: com.apple.mediastream.subscription.push userinfo: { r = xxxxxxxx; } oct 25 22:35:29 iphone mstreamd[1735] <notice>: (note ) ps: <msiosmediastreamdaemon: 0x157e0c530>: push notification received photo stream targetpersonid xxxxxxxx. oct 25 22:35:29 iphone mstreamd[1735] <notice>: (note ) mstreamd: <mspowerbudget: 0x157e84410>: plugged in external power. allowing file transfers. oct 25 22:35:29 iphone mstreamd[1735] <notice>: (note ) mstreamd: <mspowerbudget: 0x157e84410>: push received. allowing file transfers continue 60.00 seconds oct 25 22:35:29 iphone mstreamd[1735] <notice>: (note ) ps: mssubscriber - xxxxxxxx found 1 new asset collections. oct 25 22:35:30 iphone assetsd[1624] <warning>: unable open file save extended attributes (no such file or directory).
in situation ios 9, image not uploaded when app active, , uploaded when app goes background.
i suspect issue due 1. system setting is activated presentation of uiimagepickercontroller in ios8 or 2. issue caching servers in ios 9 suggested log entries.
anyone have idea going on? ideas appreciated! thanks!
i think i've found solution. seems if avcapturesession running, icloud photo stream not synchronized. calling stoprunning method (as below) seems trick:
[self.camerasession stoprunning];
Comments
Post a Comment