Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20396] iOS: Main-Thread: Cannot create proxies in callbacks

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-04-05T15:52:53.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsiOS
Labelsios, mainthread, qe-5.4.0
ReporterHans Knöchel
AssigneeHans Knöchel
Created2016-02-13T13:21:32.000+0000
Updated2016-07-29T21:39:24.000+0000

Description

Not sure how to proper name this ticket, but it's something with the going wrong. So whenever we want to create a Ti.UI.iOS.* proxy e.g. Ti.UI.iOS.Toolbar or Ti.UI.iOS.LivePhotoView inside a callback of a Ti.Media.openPhotoGallery (and probably other async callbacks), the proxy cannot be found and it throws the attached error. Example:
Ti.Media.openPhotoGallery({
    mediaTypes: [Ti.Media.MEDIA_TYPE_VIDEO, Ti.Media.MEDIA_TYPE_PHOTO, Ti.Media.MEDIA_TYPE_LIVEPHOTO],
    success: function(e) {
      var toolbar = Ti.UI.iOS.createToolbar({
          width: 300,
          height: 30,
          backgroundColor: "#f00"
      });
      win.add(toolbar);
    }
  });

var win = Ti.UI.createWindow({backgroundColor: "#fff"});
win.open();
The example will crash as soon as the callback is invoked. If we call it directly, the app wont crash. Note: The warning \[WARN\] Creating \[object TiUIiOS\] in a different context than the calling function. is logged before the crash. So it might be related to TIMOB-20397, although the TiUIiOSProxy gets initialized correctly with \[\[TiUIiOSProxy alloc\] _initWithPageContext:\[self executionContext\]\];.

Attachments

FileDateSize
Simulator Screen Shot 11.03.2016, 13.32.54.png2016-03-11T12:36:09.000+000079881

Comments

  1. Hans Knöchel 2016-03-11

    [~penrique] Added some more infos and screenshots.
  2. Hans Knöchel 2016-03-15

    PR: https://github.com/appcelerator/titanium_mobile/pull/7847
  3. Josh Longton 2016-07-28

    [~hansknoechel] [~wluu] and I have been unable to reproduce the issue above, do you have any more steps or ENV details that could help. Thanks
  4. Hans Knöchel 2016-07-29

    [~jlongton] Probably because it has been fixed / merged since a while. So if the above examples runs through, it's great and as supposed to be!
  5. Josh Longton 2016-07-29

    Verified as fixed. Tested on:
       iPhone 6s (9.3.1)
       iOS Simulator (9.3)
       
Mac OSX El Capitan 10.11.6
       Studio: 4.7.0.201607130543
       
Ti SDK: 5.4.0.v20160727143921
       
Appc NPM: 4.2.7
       Appc CLI: 5.4.0-37
       Node: v4.4.4
       
    *Closing issue.*

JSON Source