Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25392] iPad Crash: Taking a photo will cause app to crash after the first successful attempt

GitHub Issuen/a
TypeBug
PriorityCritical
StatusResolved
ResolutionCannot Reproduce
Resolution Date2018-07-19T13:12:32.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelscrash, ios, ipad, photo
ReporterPeter Ladis
AssigneeUnknown
Created2017-10-13T14:54:40.000+0000
Updated2018-07-19T13:12:33.000+0000

Description

Nothing special with my code...this is hit the first time and it works...the second..app crashes
Ti.Media.showCamera({
  success: function(event) {
    // called when media returned from the camera
    Ti.API.info('Our type was: ' + event.mediaType);
    if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {

      var photo = event.media;
      if (photo != null) {

      }
    } else {

    }
  },
  cancel: function() {

  },
  error: function(error) {
    // called when there's an error
    var a = Titanium.UI.createAlertDialog({
      title: 'Camera'
    });
    if (error.code == Titanium.Media.NO_CAMERA) {
      a.setMessage('Please run this test on device');
    } else {
      a.setMessage('Unexpected error: ' + error.code);
    }
    a.show();
  },
  saveToPhotoGallery: false,
  allowEditing: false,
  mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO]
});

Comments

  1. Hans Knöchel 2017-10-13

    Titanium SDK-version used? iOS version used? And does it work on the iPhone?
  2. Peter Ladis 2017-10-13

    Here are my specs from build Operating System Name = Mac OS X Version = 10.12.6 Architecture = 64bit # CPUs = 8 Memory = 17179869184 Node.js Node.js Version = 4.8.4 npm Version = 2.15.11 Titanium CLI CLI Version = 5.0.14 Titanium SDK SDK Version = 6.2.2.GA SDK Path = /Users/pladis/Library/Application Support/Titanium/mobilesdk/osx/6.2.2.GA Target Platform = iphone ****Note after moving to ios11 and the new SDK...take photo was crashing on iPhone when i had the setting set to "Save to Phone" by taking that off...iphone works fine....but my users out in the field are complaining about iPad crashes
  3. Peter Ladis 2017-10-13

    IOS is 9.3.5
  4. Hans Knöchel 2017-10-13

    The iOS 11 crash is because Apple requires the new key NSPhotoLibraryAddUsageDescription in addition to NSPhotoLibraryUsageDescription in order to save photos to the gallery. Ti SDK 6.3.0 will throw a readable error log before Apple let's it crash. For the iOS 9.3.5 iPad crash, we'll try to reproduce it. And please add a crash trace-log
  5. Peter Ladis 2017-10-13

    So I'm running on an actually device...it just stops tracing.. says application ended. Any other suggestions? I added this: NSPhotoLibraryAddUsageDescription but i have since turned off all saving to library feature. and the iPad is still crashing
  6. Peter Ladis 2017-10-13

    Also...attaching a photo from library seems to work fine...its only taking a photo.
  7. Peter Ladis 2017-10-13

    my users had not issue with 6.2.0 should i move the app back?
  8. Hans Knöchel 2017-10-15

    Thank you for the insight Peter! If it did not happen in 6.2.0, then that's even more interesting. If possible, are you able to see if it works in 6.2.1? I checked the underlaying code but it did not change anything related in Ti.Media, so it has to to something different to look into. *EDIT*: Both 6.2.1 and 6.2.2 did not change any iOS sources (only CLI-changes and Android-fixes). Are you sure 6.2.0 works fine? Also, does using Xcode 8 change the situation? Trying hard to troubleshoot this.
  9. Peter Ladis 2017-10-15

    OK so i went back to 6.2.1 and it works. Moving to 6.2.0...first time i tried to take a picture it crashed....Same code..same device
  10. Hans Knöchel 2018-07-19

    Resolving as cannot reproduce, since our internal tests all passed and the kind of error suggests missing Info.plist permissions.

JSON Source