You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/11/24 23:07:56 UTC

[GitHub] [cordova-plugin-camera] AndrWeisR commented on issue #530: iOS: "UI API called on a background thread" and plugin is VERY slow to initialise

AndrWeisR commented on issue #530: iOS: "UI API called on a background thread" and plugin is VERY slow to initialise
URL: https://github.com/apache/cordova-plugin-camera/issues/530#issuecomment-557938337
 
 
   Actually, the fix is to move the following code in `https://github.com/apache/cordova-plugin-camera/blob/master/src/ios/CDVCamera.m`:
   
   ```
   - (void)showCameraPicker:(NSString*)callbackId withOptions:(CDVPictureOptions *) pictureOptions
   {
   //    CDVCameraPicker* cameraPicker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
   //    self.pickerController = cameraPicker;
   //
   //    cameraPicker.delegate = self;
   //    cameraPicker.callbackId = callbackId;
   //    // we need to capture this state for memory warnings that dealloc this object
   //    cameraPicker.webView = self.webView;
   
       // Perform UI operations on the main thread
       dispatch_async(dispatch_get_main_queue(), ^{
           // Move the init code here:
           CDVCameraPicker* cameraPicker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
           self.pickerController = cameraPicker;
   
           cameraPicker.delegate = self;
           cameraPicker.callbackId = callbackId;
           // we need to capture this state for memory warnings that dealloc this object
           cameraPicker.webView = self.webView;
   
           // If a popover is already open, close it; we only want one at a time.
           if (([[self pickerController] pickerPopoverController] != nil) && [[[self pickerController] pickerPopoverController] isPopoverVisible]) {
               [[[self pickerController] pickerPopoverController] dismissPopoverAnimated:YES];
               [[[self pickerController] pickerPopoverController] setDelegate:nil];
               [[self pickerController] setPickerPopoverController:nil];
           }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org