问题标签 [photokit]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ios - 如何使用 PhotoKit 访问慢动作视频的 NSData/NSURL
使用新的 Photo 框架,我可以NSData
使用requestImageDataForAsset
. 我还可以使用PHImageFileURLKey
返回的info NSDictionary
.
这适用于图像和普通视频。
但是,当资产是 PHAssetMediaSubtypeVideoHighFrameRate(慢动作视频)时,返回的数据对应于包含视频第一帧的 JPG 文件(NSData、dataUTI 和 info 字典都指向同一个 jpg 文件)。例如,这是慢动作视频返回的 URL 和 dataUTI:
PHImageFileURLKey = "file:///var/mobile/Media/PhotoData/Metadata/DCIM/100APPLE/IMG_0642.JPG"; PHImageFileUTIKey = "public.jpeg";
为什么会这样?如何访问慢动作视频的 NSData/NSURL 而不是这个 JPG 预览?
objective-c - Photokit 中的元数据(EXIF、TIFF 等)
在 iOS 8 中,使用新的 PhotoKit,创建新图像的方法是使用-[PHPhotoLibrary performChanges:completionHandler]
,这样:
但是,我找不到任何关于如何在图像上设置元数据的文档。
在旧的 ALAssetLibrary 中(它仍然有效,并且可能仍然是前进的“正确”方式),您只需使用-[ALAssetLibrary writePhotoToSavedPhotosAlbum:metadata:completionBlock:]
,它允许您传入元数据字典。
PhotoKit 中是否有等效的方法?
ios - PHImageManager 返回缩略图而不是请求的大小
我有这段代码用于检索图像并将其添加到数组中:
问题是图像仅作为缩略图添加。如何确保图像以 targetSize 加载然后添加到数组中?
谢谢
ios - 在 iOS 8 中编辑照片:允许“YourApp”修改这张照片?
在 iOS8 中,使用 Photos.framework,当您使用 修改照片时-[PHPhotoLibrary performChanges:]
,您会得到以下用户对话框:
似乎没有任何办法绕过这个对话框,iOS 似乎每次保存时都会询问,甚至是以前修改(和允许)的照片。
有什么方法可以请求在 iOS8 中编辑照片的一揽子权限?其他解决方法或帮助?
附加信息:
我通常在模拟器中测试这个。这里有任何已知的差异吗?
为了响应(可能现在已删除)答案,此断言在
/li>-performChanges:
通过之前:
ios - In PhotoKit, modifying PHAsset leaves original around. How? Overridable?
It seems like modifications to a particular PHAsset
photo keep a version of the original around somehow, in order to be able to do this:
- Is this documented (from a programming standpoint) somewhere?
- Can the original asset ever be overwritten?
ios - getting a poster frame from a video with PhotoKit (iOS8)
I want to extract a UIimage from a video asset, to use as a poster. According to the doc for the PHImageManager
, I should be able to use requestImageForAsset:targetSize:contentMode:options:resultHandler:
. Quoting from the doc:
You can use this method for both photo and video assets—for a video asset, an image request provides a thumbnail image or poster frame.
That hasn't been my experience though. Using requestImageForAsset:targetSize:contentMode:options:resultHandler:
with a video asset, the callback block always returns nil for the image and a nil error. The info dictionary returned looks is as follow (nothing I could make sense of)
{
PHImageFileSandboxExtensionTokenKey = "31c0997752ae82ee32953503bd6d9a2436c50fac;00000000;00000000;000000000000001a;com.apple.app-sandbox.read;00000001;01000003;00000000000756cf;/private/var/mobile/Media/DCIM/100APPLE/IMG_0008.MOV";
PHImageFileURLKey = "file:///var/mobile/Media/DCIM/100APPLE/IMG_0008.MOV";
PHImageFileUTIKey = "dyn.ah62d4uv4ge804550";
PHImageResultDeliveredImageFormatKey = 9999;
PHImageResultIsDegradedKey = 0;
PHImageResultIsInCloudKey = 0;
PHImageResultIsPlaceholderKey = 0;
PHImageResultRequestIDKey = 26;
PHImageResultWantedImageFormatKey = 9999;
}
Here is the method I wrote in a PHAsset
category to extract an image from a video PHAsset below. Has anyone been able to make this work?
ios - PHAsset:什么是“assetSource”?
我正在枚举一个 PHFetchResult。如果我对返回的 PHAsset 执行 println,我会得到:
有谁知道assetSource=3
比特是什么?如果可能的话,我想在assetSource 上运行一个谓词,但在任何地方都找不到关于它是什么或如何访问它的任何信息。是私人的吗?
ios - How to determine if iCloud Photo Library is enabled?
I would like to modify my app's behavior based on whether or not iCloud Photo Library is enabled or disabled. How does one determine that status?
And is there a way to subscribe to a notification such that if the user changes that setting my app would know and be able to update to reflect that new status?
ios - How can I determine file size on disk of a video PHAsset in iOS8
I can request a video PHAsset using the Photos framework in iOS8. I'd like to know how big the file is on disk. There doesn't seem to be a property of PHAsset to determine that. Does anyone have a solution? (Using Photos framework not required)
ios - 如何知道 PHAsset 是否已被修改?
更具体地说,您如何知道 aPHAsset
的标的资产的当前版本是否与原始版本不同?
我的用户只需要在必要时在当前资产或原始资产之间进行选择。然后我需要他们的答案PHImageRequestOptions.version
。