有什么方法可以检查设备上的媒体是否物理可用。换句话说,如何使用 swift 或 Objective c 识别 iCloud 媒体。
我试图访问以下属性,但似乎存在一些问题。
public struct PHAssetSourceType : OptionSet {
public init(rawValue: UInt)
public static var typeUserLibrary: PHAssetSourceType { get }
public static var typeCloudShared: PHAssetSourceType { get }
public static var typeiTunesSynced: PHAssetSourceType { get }
}
检查 iCloud 媒体的代码。
let assetType = (self.assets?[indexPath.row])! as PHAsset
// let sourceType = assetType.sourceType as PHAssetSourceType
if assetType.sourceType.rawValue == 2 /*.typeCloudShared*/ {
(cell as! FNSCameraRollCollectionViewCell).iCloudImage.isHidden = false
}
**OR**
if assetType.sourceType == .typeCloudShared {
(cell as! FNSCameraRollCollectionViewCell).iCloudImage.isHidden = false
}
我得到以下结果:
PHAssetSourceType(原始值:1)
我的目标是自定义相机胶卷并在 iCloud 媒体上显示图标。