Problem Description
Smart Banner successfully launches an app. But as soon as we try to use "app-argument" parameter to pass anything (even with a custom scheme url that app supports) app will crash right after the launch/resume due to uncaught exception:
: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: source)'
Smart Banners doc: https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html#//apple_ref/doc/uid/TP40002051-CH6-SW2
Extra information
ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
Reason:
setObjectForKey: object cannot be nil (key: source)
Stack trace:
I think the issue is related to launchOptions dictionary.
http://docs.appcelerator.com/titanium/3.0/#!/api/launchOptions
It seems that Titanium code doesn't check and set nil value where it cannot be nil.
Steps to reproduce
Get the app from here:
TapHunter - The Craft Beer Finder
https://itunes.apple.com/us/app/taphunter-craft-beer-finder/id512023104?mt=8
(anyone compiled with the latest 3.2.3 SDK).
How to reproduce:
1) Download an app (one of the mentioned above or any other you know that was built using latest SDK and are in app store)
2) Create a html page with the following meta tag:
http://test.com ">
Where 512023104 is the "TapHunter - The Craft Beer Finder" app id but can be your app id or 421224709 if you want to try with "Farm Progress".
3) Open this page using safari on your device with the installed app
4) Click on Smart Banner "OPEN" link and app will crash right after the launch
Please provide a simple runnable test case to reproduce this issue and we would be happy to take a look.
I will explain how to reproduce and where I think you should look for the issue. Smart App Banners work on real device only and for the apps that are in the App Store (Safari needs a real numeric itunes app id). I tried and was able to crash some other apps that are available on this page to prove that this is Titanium and not an app specific issue: http://www.appcelerator.com/customers/app-showcase/ e.g. Farm Progress https://itunes.apple.com/us/app/farm-progress/id421224709?mt=8 TapHunter - The Craft Beer Finder https://itunes.apple.com/us/app/taphunter-craft-beer-finder/id512023104?mt=8 I tried a bunch of apps but it seems that issue is reproducible for the ones that were updated in 2014. I was not able to reproduce it for the late 2013 apps. So we are talking about one of the latest versions of Titanium SDK. How to reproduce: 1) Download an app (one of the mentioned above or any other you know that was built using latest SDK and are in app store) 2) Create a html page with the following meta tag: http://test.com"> Where 512023104 is the "TapHunter - The Craft Beer Finder" app id but can be your app id or 421224709 if you want to try with "Farm Progress". 3) Open this page using safari on your device with the installed app 4) Click on Smart Banner "OPEN" link and app will crash right after the launch Device console has the same error message for all apps: [ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'. Reason: *** setObjectForKey: object cannot be nil (key: source) Stack trace: I think the issue is related to launchOptions dictionary. http://docs.appcelerator.com/titanium/3.0/#!/api/launchOptions It seems that Titanium code doesn't check and set nil value where it cannot be nil.
If you want to test a custom version or add some debug logging. You can do this on a real app store app you own. You need to install your app from app store then don't delete it but override it with your debug version using "Deploy to iOS device" in Titanium Studio. Smart Banner will work and will crash your app.
Were you able to reproduce the issue? Do you need anything else?
This issue is still in 3.2.3 GA version. App build on 3.2.3 GA works fine on iOS 6. I haven't tested but looks like it is an issue when build with 3.2.3 GA and running on iOS 7.1.1
Hello [~vlad1k]! Thanks for your report! Do you have any testcase about how do you handle this argument in your mobile app? Best Regards,
You don't need any logic to handle this argument. The problem is within Titanium. It crashes even before can reach any handler and crashes when there is no handler at all. Just pass an argument and you will see a crash.
Thanks for you report. The platform team will set the priority of this bug.