我想感謝任何人都可以提供幫助。我正在學習從https://www.youtube.com/watch?v=ztIBNHOm35E或https://github.com/TDAbboud/PhotosGalleryApp或https://github.com/TDAbboud/PhotosGalleryApp帶GPS數據的imagePickerController(斯威夫特)
這個非常好的快速示例代碼我正在關注所選相機膠捲照片中的GPS數據。哪些應用程序需要使用imagePickerController選擇任何照片並放入應用程序相冊。但GPS數據從以下功能中缺失(從Camera Roll中選取照片,然後放入App Album中)。
我的問題:是如何使用imagePickerController來包含GPS在新相冊中創建照片/圖像。
//UIImagePickerControllerDelegate Methods
func imagePickerController(picker: UIImagePickerController!, didFinishPickingMediaWithInfo info: NSDictionary!){
// http://stackoverflow.com/questions/26391158/getting-metadata-in-swift-by-uiimagepickercontroller?rq=1
let metadata = info[UIImagePickerControllerMediaMetadata] as? NSDictionary //Try to get gps info
let image = info[UIImagePickerControllerOriginalImage] as? UIImage
//Implement if allowing user to edit the selected image
//let editedImage = info.objectForKey("UIImagePickerControllerEditedImage") as UIImage
let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
dispatch_async(dispatch_get_global_queue(priority, 0), {
PHPhotoLibrary.sharedPhotoLibrary().performChanges({
let createAssetRequest = PHAssetChangeRequest.creationRequestForAssetFromImage(image)
let assetPlaceholder = createAssetRequest.placeholderForCreatedAsset
let albumChangeRequest = PHAssetCollectionChangeRequest(forAssetCollection: self.assetCollection, assets: self.photosAsset)!
albumChangeRequest.addAssets([assetPlaceholder!])
}, completionHandler: {(success, error)in
dispatch_async(dispatch_get_main_queue(), {
NSLog("Adding Image to Library -> %@", (success ? "Sucess":"Error!"))
picker.dismissViewControllerAnimated(true, completion: nil)
})
})
})
}
func imagePickerControllerDidCancel(picker: UIImagePickerController!){
picker.dismissViewControllerAnimated(true, completion: nil)
}
}
http://stackoverflow.com/questions/7965299/write-uiimage-along-with-metadata-exif-gps-tiff-in-iphones-photo-library – 2015-05-22 08:52:51
難道我的回答幫助?如果是這樣,請接受它。 – fuzz 2015-08-26 05:17:03