gpt4 book ai didi

ios - 强制保存的图像与iCloud Photo Stream同步

转载 作者:行者123 更新时间:2023-12-01 16:28:53 25 4
gpt4 key购买 nike

我有一个可定期拍摄图像的应用程序,我希望在拍摄图像后立即将其上传到iCloud Photo Stream。

看来需要满足某些条件才能使它起作用。它似乎仅在运行iOS 8时有效,该设备已连接至无线设备,并使用UIImagePickerController至少拍摄了一次图片(而不是AVCapture)。出现时,似乎UIImagePickerController更改了一些系统设置,从而允许随后将图像自动上载到iCloud Photo Stream。如果我仅使用AVCapture拍摄照片,它将无法工作。我已确认在iCloud设置中启用了“上传到我的照片流”,并且存在 Activity 的无线连接。

这是用于保存从UIImagePickerController获得的图像的方法:

- (void)saveImage : (UIImage *)image {
// Add image to the photo library
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetChangeRequest *assetChangeRequest =
[PHAssetChangeRequest creationRequestForAssetFromImage:image];
} completionHandler:^(BOOL success, NSError *error) {
if (!success)
NSLog(@"Error creating asset: %@", error);
}];
}

在装有iOS 8的iPad上运行时,以下是我在设备系统日志中看到的条目:
Oct 22 21:11:06 iPad mstreamd[14409] <Notice>: (Note ) PS: MSPublisher - xxxxxxxx Submitting 1 asset collections for 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 for 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 for My Photo Stream with targetPersonID xxxxxxxx.
Oct 22 21:11:12 iPad mstreamd[14409] <Notice>: (Note ) mstreamd: <MSPowerBudget: 0x1666fae0>: Plugged in to external power. Allowing file transfers.
Oct 22 21:11:12 iPad mstreamd[14409] <Notice>: (Note ) mstreamd: <MSPowerBudget: 0x1666fae0>: Push received. Allowing file transfers to continue for 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 to open file to save extended attributes (No such file or directory).

在装有iOS 9.1的iPhone上运行时,我有类似的日志条目,除了关于缓存服务器的其他警告/错误消息以粗体显示之外:
Oct 25 22:35:28 iPhone mstreamd[1735] <Notice>: (Note ) PS: MSPublisher - xxxxxxxx Submitting 1 asset collections for 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 with 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 for 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 for My Photo Stream with targetPersonID xxxxxxxx.
Oct 25 22:35:29 iPhone mstreamd[1735] <Notice>: (Note ) mstreamd: <MSPowerBudget: 0x157e84410>: Plugged in to external power. Allowing file transfers.
Oct 25 22:35:29 iPhone mstreamd[1735] <Notice>: (Note ) mstreamd: <MSPowerBudget: 0x157e84410>: Push received. Allowing file transfers to continue for 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 to open file to save extended attributes (No such file or directory).

在这种情况下,使用iOS 9时,当我的应用程序处于 Activity 状态时,不会上传图像,仅在应用程序进入后台时才上传图像。

我怀疑该问题是由于1.某些系统设置仅在iOS8中通过UIImagePickerController的显示被激活的,或者2.日志条目所建议的在iOS 9中缓存服务器的某些问题。

任何人都知道发生了什么事吗?任何想法将不胜感激!谢谢!

最佳答案

我想我已经找到了解决方案。看来,如果正在运行AVCaptureSession,则iCloud Photo Stream将不会同步。调用stopRunning方法(如下所示)似乎可以解决问题:

[self.cameraSession stopRunning];

关于ios - 强制保存的图像与iCloud Photo Stream同步,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33373903/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com