1

Our iOS 9 app uses PhotoKit to display photos from the user's Photo Library, including iCloud Shared Albums. Unfortunately, PHImageManager.defaultImageManager().requestImageForAsset is regularly failing to load full-size images for some of our users, particularly ones from Shared Albums.

Here is what I'm seeing in the Xcode Devices log:

Mar  4 10:25:52 iPad1 mstreamd[517] <Notice>: (Warn ) mstreamd: 40858279 is not allowed to download assets at this time.
Mar  4 10:25:52 iPad1 mstreamd[517] <Notice>: (Note ) AS: <MSASAssetDownloader: 0x12cd66320>: Not allowed to download assets at this time.
Mar  4 10:25:57 iPad1 mstreamd[517] <Notice>: (Warn ) mstreamd: 40858279 is not allowed to download assets at this time.
Mar  4 10:25:57 iPad1 mstreamd[517] <Notice>: (Note ) AS: <MSASAssetDownloader: 0x12cd66320>: Not allowed to download assets at this time.
Mar  4 10:25:57 iPad1 mstreamd[517] <Notice>: (Warn ) mstreamd: 40858279 is not allowed to download assets at this time.
Mar  4 10:25:57 iPad1 mstreamd[517] <Notice>: (Note ) AS: <MSASAssetDownloader: 0x12cd66320>: Not allowed to download assets at this time.
Mar  4 10:25:58 iPad1 mstreamd[517] <Notice>: (Warn ) mstreamd: 40858279 is not allowed to download assets at this time.
Mar  4 10:25:58 iPad1 mstreamd[517] <Notice>: (Note ) AS: <MSASAssetDownloader: 0x12cd66320>: Not allowed to download assets at this time.
Mar  4 10:25:58 iPad1 mstreamd[517] <Notice>: (Warn ) mstreamd: 40858279 is not allowed to download assets at this time.
Mar  4 10:25:58 iPad1 mstreamd[517] <Notice>: (Note ) AS: <MSASAssetDownloader: 0x12cd66320>: Not allowed to download assets at this time.
Mar  4 10:26:27 iPad1 mstreamd[517] <Notice>: (Note ) AS: <MSASPersonModel: 0x12cd60af0>: Attempting to re-enqueue asset (GUID: 10BFAC94-2701-44CD-93F2-B71F2812D6D1 collectionGUID: 7349761C-2809-406F-8F35-05FFB5DF22CA) for download. Ignoring.

`

Have other people encountered this problem? If so, have you found a workaround that can be done in the code (the code in our already does one retry of the requestImageForAsset method)?

Oddly, the problem seems to eventually resolve itself after a long period of time (an hour?), but so far we haven't found a pattern.

[Update] Upon further analysis of the log and some experimentation, we've discovered that it may have something to do with requiring the device to be plugged in - the device had about 50% battery remaining). Could it be possible that iCloud photos are not available if the power level is low or the AC power is not connected??!

Mar 4 10:26:53 iPad1 mstreamd[517] <Notice>: (Note ) mstreamd: <MSPowerBudget: 0x12ce41140>: Plugged in to external power. Allowing file transfers. 
Mar 4 10:26:53 iPad1 mstreamd[517] <Notice>: (Note ) mstreamd: <MSPowerBudget: 0x12cd526d0>: Plugged in to external power. Allowing file transfers. 
Mar 4 10:26:53 iPad1 ptpd[991] <Notice>: Photo library available 

[Update 2]

We've also discovered that running the Photos app and then our app enables iCloud Photo Library access for a short time (5 minutes?). The following appears in the device log when the Photos app is backgrounded:

Mar  4 17:09:19 iPad1 mstreamd[517] <Notice>: (Note ) mstreamd: <MSPowerBudget: 0x12cd526d0>: UI no longer foregrounded. Allowing file transfers to continue for 120.00 seconds.
Mar  4 17:09:19 iPad1 mstreamd[517] <Notice>: (Note ) mstreamd: <MSPowerBudget: 0x12ce41140>: UI no longer foregrounded. Allowing file transfers to continue for 600.00 seconds.
LenK
  • 2,944
  • 2
  • 20
  • 26
  • I'm getting the same behavior when requesting a video from a shared album using `requestExportSessionForVideo:options:exportPreset:resultHandler:` on an iPad with 100% battery and plugged into the USB port of a Mac Mini. So this isn't looking like a power problem to me. Even though I specified `networkAccessAllowed` in the fetch options, I'm getting `YES` for `PHImageResultIsInCloudKey`. It smells like a bug to me but it's hard to be sure with this little feedback from the OS. – Jesse Crossen Jun 15 '16 at 18:07
  • This explanation only applies to videos, so it may not help, but this discussion explains that videos on iCloud can only be streamed from iOS and not downloaded: https://discussions.apple.com/thread/5364797?tstart=0 – Jesse Crossen Jun 15 '16 at 20:15

0 Answers0