我无法通过PHAsset提取中的照片元数据列表获取实际照片。最终我想要一系列照片。
这是我的代码(最后一分钟在返回前的最后一行投射到UIImage):
以下是一些输出:
(lldb) po rec
<PHMoment: 0x7f8c03d62820> 12A0DFC9-5B8C-4E25-A373-122A5F1E1D8A/L0/060 (null) assetCollectionType=3/0 [2014-07-14 04:28:16 +0000 - 2014-07-14 04:28:18 +0000]
(lldb) po fetchResult
<PHFetchResult: 0x7f8c03d292c0> count=5
(lldb) po firstObject
(instance_type = Builtin.RawPointer = 0x00007f8c03d8bce0 -> 0x0000000100e83170 (void *)0x0000000100e83288: PHAsset)
{
instance_type = 0x00007f8c03d8bce0 -> 0x0000000100e83170 (void *)0x0000000100e83288: PHAsset
}
(lldb) po lastObject
(instance_type = Builtin.RawPointer = 0x00007f8c03d88be0 -> 0x0000000100e83170 (void *)0x0000000100e83288: PHAsset)
{
instance_type = 0x00007f8c03d88be0 -> 0x0000000100e83170 (void *)0x0000000100e83288: PHAsset
}
(lldb) po myPhoto
(instance_type = Builtin.RawPointer = 0x00007f8c03d8b570 -> 0x0000000100e83170 (void *)0x0000000100e83288: PHAsset)
(lldb)
这对我没什么好处。
我想收集实际的UIImages。
所以我试图做一个演员:
let myPhoto: AnyObject = fetchResult.objectAtIndex(1)! as UIImage
但是这给我一个运行时崩溃/错误:
问题:如何从我的抓取中收集实际的UIImages?
答案 0 :(得分:0)
以下是:
newtype MyState' s a = MyState' { runMyState :: s -> (s, a) }
type MyState = MyState' A
newtype MyBranch e a = MyBranch { runMyBranch :: MyState (Either e a) }