0
我試圖從圖庫中選擇或通過相機捕獲圖像的路徑。 我一直在使用下面的代碼如何獲取圖片的路徑,從圖庫中選擇或通過相機捕獲
imageView.image= [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSData *webData = UIImagePNGRepresentation(imageView.image);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *localFilePath = [documentsDirectory stringByAppendingPathComponent:png];
[webData writeToFile:localFilePath atomically:YES];
NSLog(@"localFilePath.%@",localFilePath);
嘗試,但是當我通過終端檢查「文檔」發現是空文件夾。