问题标签 [phasset]
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 - PHImageManager 的方法“requestImageDataForAsset”在 Swift 中导致崩溃
我正在使用 PHImageManagers 的 requestImageDataForAsset 来计算相机胶卷中特定照片的内存大小。它在我的设备上运行良好,但一些用户在计算内存大小(通过分析和崩溃报告发现)后会发生崩溃。
请帮忙。
swift - 如何提取 PHAsset 的 Location 属性?
Xcode 说 PHAsset 没有“位置”成员。
斯威夫特的补救措施是什么?
ios - 即使启用了位置服务,(PHAsset 位置)也会为相机胶卷照片返回 (null)
我需要访问源自用户的相机胶卷/照片库的用户提交照片的 GPS 坐标。为了现代性,我正在实施 PHAsset 而不是 ALAsset。
我知道位置服务已启用,因为我可以打印出用户的当前位置,并在我的 info.plist 文件中添加了“NSLocationAlwaysUsageDescription”、“NSLocationWhenInUseDescription”和“privacy - location usage description”键。我在 ViewController 的 .h 文件中导入了 CoreLocation、MobileCoreServices 和 Photos。
我当前在 didFinishPickingMediaWithInfo 委托方法中的代码如下:
由于某种原因,这总是输出(null)。我是否缺少某些东西阻止我访问 PHAsset 位置数据?我知道 PHAsset 已正确分配,因为 [PHAsset creationDate] 适用于我选择的任何照片。
谢谢!
ios - How to use PHCachingImageManager
I know that there is already this question on SO, but I don't think that the given answer is satisfying/complete: How can IOS Photos app can show hundreds of photos in one screen?
What I want to achieve
I want something like the image selection in whatsapp (iOS) (see screenshot). When you open the camera, there is also a horizontal slider where you can see all images from your gallery.
What I tried
Right now I have the following code in my appDelegate:
Later I load the images in a UITableViewController and call the following function on scroll:
This works well but I have the problem that on every app start all my assets get cached. Is this the right approach for my problem? How can I display the gallery photos in realtime like whatsapp does?
ios - 在 iOS 上将图像保存为连拍
在 iOS 中,连拍被保存为一组为一组。我该怎么做呢?(我对 iOS 很陌生)。我相信现有的相机将图像保存为 PHAsset 但我如何创建一个新实例并添加每张照片?
ios - 使用“hidden = YES”谓词崩溃获取 PHAsset
如文档中所列,PHAsset 支持hidden (or isHidden)
获取密钥。但是,当我尝试获取隐藏资产时,我的应用程序因以下日志而崩溃:
*** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“获取选项中不支持的谓词:隐藏 == 1”
这是示例代码:
swift - PHAsset 到 UIImage
我正在尝试从 PHAsset 创建一个 UIImage(如缩略图或其他东西),以便我可以将它传递给需要 UIImage 的东西。我已经尝试过调整我在 SO 上找到的解决方案(因为他们都只是直接将它传递给一个 tableview 或其他东西),但我没有成功(可能是因为我做得不对)。
printlns 告诉我 manager.request 行现在没有做任何事情。如何获得它以将资产作为 UIImage 提供给我。
谢谢。
ios - PHAssetCollectionChangeRequest:addAssets() 现在接受 NSFastEnumeration。如何做到这一点?
我的应用程序尝试从照片导入图像并添加到相册。
但在最新的快速变化中。addAssets() 接受参数作为 NSFastEnumeration。所以我得到一个错误,如图所示。
甚至 Apple API 文档也有相同的代码:https ://developer.apple.com/library/prerelease/ios/documentation/Photos/Reference/PHAssetChangeRequest_Class/index.html#//apple_ref/occ/instp/PHAssetChangeRequest/placeholderForCreatedAsset
什么是替代方案或我现在如何添加资产?
swift - 在 Swift 中同步异步内容
我不确定为什么 Apple 会分块设计这么多东西……至少“ PHAsset to UIImage ”中的问题由于提供了选项而得以解决。但是,我需要的其他一些东西不是由选项提供的。
例如:
在这些情况下,我只希望使用一个块的函数(例如 requestContentEditingInputWithOptions 同步执行,以便我可以返回 imageURL)。有没有办法做到这一点?(我尝试过使用一些调度命令,但还没有成功)。
请注意,我需要返回 imageURL。不要试图给我一个解决方案,让我在块内写东西并且不返回 imageURL。
swift - 如何处理视频 PHAsset
我看到对于 PHContentEditingInput ( https://developer.apple.com/library/prerelease/ios/documentation/Photos/Reference/PHContentEditingInput_Class/index.html#//apple_ref/occ/instp/PHContentEditingInput/avAsset ),视频资产东西已被弃用。
如果我需要处理视频,我应该使用什么来代替?
(特别是来自 PHAsset 的 NSURL,他们在这里使用了不推荐使用的功能。还有什么我可以使用的未被弃用但可以获得 NSURL 的东西吗?)
编辑:所以......在我阅读了一些关于 AVFoundation 框架之后......我们如何在不使用不推荐使用的方法的情况下将我们的 PHAsset 转换为 AVURLAsset?