Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19906] iOS: SafariDialog close event crash

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2015-11-10T18:46:14.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.1.0
ComponentsiOS
Labelscrash, ios, safaridialog
ReporterSebastian Klaus
AssigneeHans Knöchel
Created2015-11-10T15:01:11.000+0000
Updated2015-11-10T21:10:23.000+0000

Description

SafariaDialog crashes the app after opening with an URL containing spaces
var self = Ti.UI.createWindow({
        title: L('Test')
    });

    self.addEventListener('open', function () {
        var SafariDialog = require('ti.safaridialog');

        SafariDialog.open({
            url: 'http://www.amazon.com/s/field-keywords=Transformers 4', // works not
            //url: 'http://www.amazon.com/s/field-keywords=Transformers+4', // works
            title: 'Search'
        });

        SafariDialog.addEventListener('close', function (e) {
            console.log(e);
        });
    });

    self.open();

Comments

  1. Fokke Zandbergen 2015-11-10

    [~hansknoechel] shouldn't we fix this before it is released with 5.1?
  2. Hans Knöchel 2015-11-10

    PR (Ti.SafariDialog/master): https://github.com/appcelerator-modules/Ti.SafariDialog/pull/3 PR (titanium_mobile/master): https://github.com/appcelerator/titanium_mobile/pull/7415 PR (titanium_mobile/5_1_X): https://github.com/appcelerator/titanium_mobile/pull/7416 Demo:
       
       var safariDialog = require('ti.safaridialog');
       
       Ti.API.warn('ti.safaridialog.supported ' + safariDialog.supported);
       Ti.API.warn('ti.safaridialog.getSupprted() ' + safariDialog.getSupported());
       Ti.API.warn('ti.safaridialog.isSupported() ' + safariDialog.isSupported());
       
       var win = Ti.UI.createWindow({
       	backgroundColor: "#fff"
       });
       var btn = Ti.UI.createButton({
       	title: "Open SafariDialog!"
       });
       
       btn.addEventListener("click", function(){
       	safariDialog.open({
       		url: "http://www.amazon.com/s/field-keywords=Transformers 4",
       		title: "Amazon"
       	});
       });
       
       safariDialog.addEventListener("close", function(e) {
       	Ti.API.warn(e);
       });
       
       safariDialog.addEventListener("open", function(e) {
       	Ti.API.warn(e);
       });
       
       win.add(btn);
       win.open();
       win.open();
       
  3. Eric Merriman 2015-11-10

    OK with me. Merge away.
  4. Angel Petkov 2015-11-10

    PR approved and Merged
  5. Wilson Luu 2015-11-10

    Closing ticket as fixed. Using the above demo code, verified the following: * On a iOS 9.1 device, safariDialog.supported, afariDialog.getSupported(), and safariDialog.isSupported() returns true on launch of the app. * On a iOS 9.1 device, if I press the "Open SafariDialog!" button and close the SafariDialog multiple times, then the app does not crash. * On a iOS 8.2 device, safariDialog.supported, afariDialog.getSupported(), and safariDialog.isSupported() returns false on launch of the app. Tested on: Appcelerator Studio, build: 4.4.0.201511101919 Appc CLI NPM: 4.2.1 Appc CLI Core: 5.1.0-44 Arrow: 1.3.19 SDK: 5.1.0.v20151110110428 ti.safaridialog: 1.0.2 Node: v4.2.1 OS: El Capitan (10.11.1) Xcode: 7.1.1 Devices: iphone 6s plus (9.1), iphone 6 (8.2)
  6. Sebastian Klaus 2015-11-10

    Very fast reaction. Thank you all.

JSON Source