Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 10 Camera view showing API_Cancel_Title instead of Cancel

I am working on an app using iOS 10 and using camera for taking pictures. When camera view opens, instead of cancel button there is a title "API_CANCEL_TITLE". And when I capture the pic the whole title is seeing, I want that instead of this long title it will be look "Cancel". I have used app localization. I searched few links but could not find the solution.

Here is the screen shot:

enter image description here

This is happening only in iOS 10, in iOS 9 it will working correctly here is the code:

- (IBAction)takePicturePressed:(UIButton *)sender
{

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentViewController:picker animated:YES completion:nil];
}

Please suggest...

like image 280
Gourav Joshi Avatar asked Nov 29 '16 06:11

Gourav Joshi


1 Answers

I've approached the same problem using BundleLocalization and I've traced UIImagePickerController keys, that it gets from a bundle.

Turns out, it uses 4 "tables" (in NSBundle nomenclature):

  • CameraUI (for camera)
  • PhotoLibraryServices (for PhotoLibrary)
  • PhotoLibrary (for PhotoLibrary)
  • PhotosUI (for PhotoLibrary)

In my case, all I had to do, to localize UIImagePickerController interface, it was create in the project a couple of .strings files and localize them.

Below content of mentioned files with keys I've seen (with standard english values), they are pretty self explaining

CameraUI.strings
"PHOTO" = "PHOTO";
"AEAF_LOCK_TEXT" = "AE/AF LOCK";
"API_CANCEL_TITLE" = "Cancel";
"HDR_AUTO" = "Auto";
"HDR_ON" = "On";
"HDR_OFF" = "Off";
"TIMER_OFF_TEXT" = "Off";
"USE_PHOTO" = "Use Photo";
PhotoLibraryServices.strings
"PHOTOS" = "Photos";
"CAMERA_ROLL" = "Camera roll";
"ALL_SCREENSHOTS" = "Screenshots";
PhotoLibrary.strings
"CANCEL" = "Cancel";
"RETAKE" = "Retake";
"STREAM_SHARED_BY_ME_SUBTITLE" = "From You";
"STREAM_SHARED_BY_SUBTITLE" = "From %@";
"ALBUM_IMAGE_COUNT_FORMAT" = "%@ Photos";
"ALBUM_VIDEO_COUNT_FORMAT" = "%@ Videos";
"1_ALBUM_PHOTO" = "1 Photo";
"1_ALBUM_VIDEO" = "1 Video";
"ALBUM_TWO_TYPES_LABEL_COMMAS" = "%@, %@";
PhotosUI.strings
"ALL_PHOTOS_IN_LIBRARY" = "Moments";
"PXUserCollectionsSectionTitle" = "My Albums";
"FULL_PHOTOS_GRID_ZOOM_LEVEL_TITLE" = "Moments";
"NO_PHOTOS_OR_VIDEOS" = "No Photos or Videos";
"EMPTY_ALBUM_LIST_MESSAGE_iPhone" = "You can take photos and videos using camera, or sync photos and videos onto your iPhone using iTunes";
like image 62
shc Avatar answered Oct 03 '22 04:10

shc