Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9175] iOS: Blob.nativePath throws exception for non-File Blobs

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-07-12T04:46:09.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 2.1.0
ComponentsiOS
Labelsapi, module_filesystem, parity, qe-testadded
ReporterArthur Evans
AssigneeArthur Evans
Created2012-05-18T17:05:45.000+0000
Updated2013-11-08T05:33:03.000+0000

Description

The following code throws an exception:
var myBlob = button.toImage();
Ti.API.info("Blob.nativePath: " + JSON.stringify(myBlob.nativePath));
I would expect this to return some kind of value to indicate that nativePath is not set. Instead, it throws an exception: [ERROR] Script Error = *** -[NSURL initFileURLWithPath:]: nil string parameter at app.js (line 28). In this circumstance, Android returns null, and MobileWeb returns the empty string. I believe that returning null is the intended behavior on iOS.

Comments

  1. Stephen Tramer 2012-05-21

    *NOTE:* As part of resolving this ticket, you must update the documentation to show that the bug has been fixed. See [PR #2202](https://github.com/appcelerator/titanium_mobile/pull/2202).
  2. Arthur Evans 2012-05-21

    Test case:
       //
       var win1 = Titanium.UI.createWindow({  
           title:'TIMOB-9175 Test',
           backgroundColor:'#fff'
       });
       win1.open();
       var myBlob = Ti.createBuffer({ value: "Use a string to build a buffer to make a blob."}).toBlob();
       Ti.API.info("Blob from buffer: nativePath: " + JSON.stringify(myBlob.nativePath));
       
    Should show nativePath returning null. On iOS, currently throws the exception shown above.
  3. Arthur Evans 2012-05-21

    Addressed in PR: https://github.com/appcelerator/titanium_mobile/pull/2239
  4. Michael Pettiford 2012-06-15

    Closing issue Tested with Ti Studio build 2.1.0.201206141932 Ti Mobile SDK 2.1.0.v20120614194151 hash rad27673d OSX Lion 10.7.3 iPhone 4S OS 5.1 Verified that the blob returned null
  5. Anshu Mittal 2012-07-12

    Reopening to update labels.

JSON Source