【问题标题】:PHAsset: What is 'assetSource'?PHAsset:什么是“assetSource”?
【发布时间】:2014-10-15 22:36:10
【问题描述】:

我正在枚举一个 PHFetchResult。如果我对返回的 PHAsset 执行 println,我会得到:

<PHAsset: 0x178192140> 4CBE5A4F-90BD-438B-954E-6FF1B14538CD/L0/001 mediaType=1/0, assetSource=3, (2448x3264), creationDate=2014-10-15 14:20:12 +0000, location=1, hidden=0, favorite=1

有人知道assetSource=3 位是什么吗?如果可能的话,我想在assetSource 上运行一个谓词,但在任何地方都找不到关于它是什么或如何访问它的任何信息。是私人的吗?

【问题讨论】:

    标签: ios objective-c swift photokit phasset


    【解决方案1】:

    assetSource 是一个私有变量,所以它的含义是故意不透明的。

    可以使用谓词从其description 中过滤assetSource 以进一步调查,例如in this question,但这将是一个纯粹的学术练习。

    【讨论】:

    • 谢谢。很高兴知道它可以这样做,但我最好找到另一种方法来实现我最初追求的目标。
    【解决方案2】:

    可能与 iOS9 中即将推出的 PHAssetSourceType 有关。

    struct PHAssetSourceType : OptionSetType {
    init(rawValue rawValue: UInt)
    static var TypeNone: PHAssetSourceType { get }
    static var TypeUserLibrary: PHAssetSourceType { get }
    static var TypeCloudShared: PHAssetSourceType { get }
    static var TypeiTunesSynced: PHAssetSourceType { get }
    

    }

    参考https://developer.apple.com/library/prerelease/ios/documentation/Photos/Reference/PHAsset_Class/index.html#//apple_ref/swift/struct/c:@E@PHAssetSourceType

    【讨论】:

    • 不可能! "assetSource" 可以是 3,但 PHAssetSourceType 只能是 0、1、2、4。
    • @mayqiyue 显然 asserSource 是由不同 PHAssetSourceType 的 OR-ing 制成的
    猜你喜欢
    • 1970-01-01
    • 2017-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-08
    • 2015-10-18
    • 2022-01-20
    相关资源
    最近更新 更多