10.3 utf8 file creation

I just test on our app on 10.3.

our app have no problem on the preveous version.

We made a video file using open api having korean filename. after this, we tried to move this file to album.

this file created success, can be play, but we could not move to album.


At the my code, I checked file status, File Create was successful, I saved into app's document folder, It was playable.

But after save, I tried to move album I meat "Failed to save media file error" Error log.

Is it normal?


File Creation Method .


NSString *cameraName = self.currentCamera.name;

NSString *path = [NSString stringWithFormat:@"%@_rec_%@.mp4", cameraName, [self createCurrentDateString]];

const char *filename = [path UTF8String];

mFd = open(filename, O_CREAT /| O_LARGEFILE*/ | O_TRUNC | O_RDWR, 00666);



Save To Album Method


- (void) saveFileToAlbumWithPath:(NSString*) directory path:(NSString*)path {

__block PHFetchResult *photosAsset;

__block PHAssetCollection *collection;

__block PHObjectPlaceholder *placeholder;

PHFetchOptions *fetchOptions = [[PHFetchOptions alloc] init];

fetchOptions.predicate = [NSPredicate predicateWithFormat:@"title = %@", directory];

collection = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum

subtype:PHAssetCollectionSubtypeAny

options:fetchOptions].firstObject;


[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{

PHAssetChangeRequest *assetRequest;

/

if([directory isEqualToString:HOMECAME_RECORD]){

assetRequest = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:[NSURL fileURLWithPath:path]];

}else{

assetRequest = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:[NSURL fileURLWithPath:path]];

}

placeholder = [assetRequest placeholderForCreatedAsset];

photosAsset = [PHAsset fetchAssetsInAssetCollection:collection options:nil];

PHAssetCollectionChangeRequest *albumChangeRequest = [PHAssetCollectionChangeRequest changeRequestForAssetCollection:collection assets:photosAsset];

[albumChangeRequest addAssets:@[placeholder]];

} completionHandler:^(BOOL success, NSError *error) {

if (success) {

dispatch_async(dispatch_get_main_queue(), ^{

if([directory isEqualToString:HOMECAME_RECORD]){

[self.view makeToast:commonStr(@"toast_monitoring_saved_recording_file") duration:2.0f position:CSToastPositionBottom];

} else {

[self.view makeToast:commonStr(@"toast_monitoring_saved_screenshot") duration:2.0f position:CSToastPositionBottom];

}

});

} else {

dispatch_async(dispatch_get_main_queue(), ^{

if([directory isEqualToString:HOMECAME_RECORD]){

[self.view makeToast:commonStr(@"toast_monitoring_fail_saved_recording") duration:2.0f position:CSToastPositionBottom];

} else {

[self.view makeToast:commonStr(@"toast_monitoring_fail_saved_screenshot") duration:2.0f position:CSToastPositionBottom];

}

});

NSLog(@"Failed to save media file error :%@", error);

}

}];

}