Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24152] iOS: Ti.Media.saveToPhotoGallery crashes on device in SDK 6.0.0.GA

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-11-18T10:17:15.000+0000
Affected Version/sRelease 6.0.0
Fix Version/sRelease 6.0.1
Componentsn/a
Labelsios, qe-6.0.1, regression
Reporternicolomonili
AssigneeHans Knöchel
Created2016-11-16T16:45:07.000+0000
Updated2017-02-28T10:04:45.000+0000

Description

With SDK *6.0.0.G.A* there is a problem with the function *Ti.Media.saveToPhotoGallery()*; - On *simulator* works ok. - On *device* when call the function the result is this :
"undefined is not a function (evaluating 'Ti.Media.saveToPhotoGallery')";
With SDK *5.5.1.G.A* works ok also on device

Comments

  1. Hans Knöchel 2016-11-16

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/8613 PR (6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8614 Test-case:
       var win = Ti.UI.createWindow({
           backgroundColor: "#fff"
       });
        
       var btn = Ti.UI.createButton({
           title: "Save to Photo Gallery"
       });
        
       btn.addEventListener("click", function() {
           var blob = Ti.UI.createView({
               backgroundColor: "red",
               width: 500,
               height: 500
           }).toImage();
        
           Ti.Media.saveToPhotoGallery(blob, {
       		success: function(e) {
       	        Ti.API.info("Success!");
       		},
       		error: function(e) {
       			Ti.API.error("Error: " + e.error);
       		}
           });
       });
        
       win.add(btn);
       win.open();
       
  2. Harry Bryant 2016-11-18

    Verified as fixed, Ti.Media.saveToPhotoGallery no longer crashes on device with the latest 6.0.1 build. Tested On: iPhone 6 Plus 10.1.1 Device iPhone 5S 9.3.5 Device Mac OS Sierra (10.12.1) Ti SDK: 6.0.1.v20161118021643 Appc Studio: 4.8.0.201611121409 Appc NPM: 4.2.8 App CLI: 6.0.0 Xcode 8.1 Node v4.4.7 *Closing ticket.*
  3. Carlos Henrique Zinato 2017-02-27

    Guys, I'm on SDK 6.0.1, my iphone/Classes/MediaModule.m has the macros as well as my "iphone/Classes/defines.h" but it still saying ""undefined is not a function (evaluating 'Titanium.Media.saveToPhotoGallery')"" Do you have any clue? Thanks!
  4. Hans Knöchel 2017-02-27

    Hey Carlos, that should be fixed then. Do you have an example code we could test? Did you test my above snippet? Just paste it here or send on Slack and we'll take care immediately.
  5. Carlos Henrique Zinato 2017-02-28

    yeap, with your code snippet it doesn't work as well =/ On simulator the app crashes and on device I got the error above

JSON Source