我想檢查latestObject是什麼類型。下面是一些代碼:檢查提取的對象是Swift中的Image還是Video
allMedia = PHAsset.fetchAssetsWithOptions(fetchOptions)
let allPhotos = PHAsset.fetchAssetsWithMediaType(.Image, options: fetchOptions)
let allVideo = PHAsset.fetchAssetsWithMediaType(.Video, options: fetchOptions)
print("Found \(allMedia.count) media")
print("Found \(allPhotos.count) images")
print("Found \(allVideo.count) videos")
let latestObject: AnyObject! = allMedia.lastObject
// How to check what type latestObject is?
// I think something with mediaType but how is it exactly going?
檢查:1)http://stackoverflow.com/questions/31582717/how-to-check-a-file-is-video-or-image 2)http://stackoverflow.com/questions/17145844/ iphone-how-to-check-if-the-file-is-a-directory-audio-video-or-image – sohil