-
17 Jan 2013 8:24 AM #1
ST 2.1 and 2.2alpha: Ext.device.Device.scheme is false on launch from custom URL
ST 2.1 and 2.2alpha: Ext.device.Device.scheme is false on launch from custom URL
Summary: successfully created a native iOS app with a custom URL scheme. In both iOS Simulator and on a real device, launching the app from cold using the custom URL does not pass the URL to the app (Ext.device.Device.scheme is always false, regardless of whether you start the app using the custom URL or not). If the app is already running in the background, however, then the custom URL used to resume it is successfully passed to the schemeupdate event.
Details:
Following the instructions at http://docs.sencha.com/touch/2-1/#!/....device.Device to specify a Custom Scheme URL for my native iOS app.
This occurs on both Sencha Touch 2.1 and 2.2alpha and on both iOS 5 and iOS 6.
Steps to reproduce:- Generate a new app using
Code:$ sencha generate app -path /Library/WebServer/Documents/SchemeTest
- Add 'Ext.device.Device' to the requires: property of the application
- Add the following code to the launch function in app.js: Code:
alert("Scheme is " + Ext.device.Device.scheme); if (Ext.device.Device.scheme) { // the application was opened via another application. Do something: alert('Applicaton pened via another application: ' + Ext.device.Device.scheme.url); } // Listen for future changes Ext.device.Device.on('schemeupdate', function(device, scheme) { // the application was launched, closed, and then launched another from another application // this means onReady wont be called again ('cause the application is already running in the // background) - but this event will be fired alert('Applicated reopened via another application: ' + scheme.url); }, this); - Specify a custom URL scheme by adding the following line to packager.json:This will cause URLs of the form sencha:HereIsMyURL to open your app on an iOS device or the iOS Simulator.Code:
"rawConfig": "<key>CFBundleURLTypes</key><array><dict><key>CFBundleURLSchemes</key><array><string>sencha</string></array><key>CFBundleURLName</key><string>com.sencha.example</string></dict></array>"
- Run the app in iOS Simulator with this command:Code:
$ sencha package run packager.json
- The app will start in the iOS Simulator and will show the URL scheme to be false, since the app has not been started using a custom URL:
Scheme1.png - Click OK to close the alert dialog, then press the Home button on the iOS Simulator to move the app to the background. Open Mobile Safari and enter the URL sencha:HereIsMyURL and press Enter or click the Go button to resume the app:
Scheme2.png - The app will reopen and you will see the URL has been correctly passed in:
Scheme3.png - Tap the Home button on iOS Simulator, then double-tap the Home button and hold the mouse button down on the "My Application" icon until the icons start to shake. Use the red "-" to completely kill "My Application" so that it's no longer running:
Scheme4.png - Press the Home button again, then go back into Mobile Safari and re-enter the URL sencha:HereIsMyURL and press Enter or click the Go button to start the app.
- The app will start, but Ext.device.Device.scheme is still false and so the URL cannot be retrieved.
Scheme1.png - (Optional) Configure your packager.json file with a valid applicationName, applicationId, bundleSeedId, certificateAlias and provisionProfile, and set the platform to iOS. Then rebuild your native app for your real iOS device using $ sencha package build packager.json, copy the app to your device using XCode, and repeat steps 7 through 11 on the real device. The results are the same.
- Generate a new app using
-
17 Jan 2013 9:22 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
Thanks for the report! I have opened a bug in our bug tracker.
-
26 Mar 2013 12:32 PM #3
This has been listed as fixed in the header of this post for two months, but I have no idea how we can obtain this fix. Can you provide some guidance here?
Thanks!
-
9 Apr 2013 5:41 AM #4
Not working in ST 2.1.1
Not working in ST 2.1.1
I'm observing here the same problem. Ext.device.Device.scheme is always false. The application needs to run to obtain the url from another app.
Is this fixed in later versions?
-
17 May 2013 6:55 AM #5
Got it working here (even when removed from memory).
I used my applicationId as the name for the string inside CFBundleURLName and inside the new sencha touch command I ran: sencha app build native (in the folder where the packager.json file resides).
-
17 May 2013 1:37 PM #6
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-3912
in
Sprint 30.


Reply With Quote