Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20073] iOS: Dynamic Shortcut crashes app when it has no userInfo

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionDuplicate
Resolution Date2015-11-30T01:34:31.000+0000
Affected Version/sRelease 5.1.1
Fix Version/sRelease 5.2.0
ComponentsiOS
Labelsqe-5.2.0
ReporterFokke Zandbergen
AssigneeHans Knöchel
Created2015-11-29T20:52:11.000+0000
Updated2016-01-22T00:41:56.000+0000

Description

The following sample demonstrates that when you remove the userInfo property the app will crash when you open it using the dynamic shortcut.
var appShortcuts = Ti.UI.iOS.createApplicationShortcuts();

Ti.App.iOS.addEventListener('shortcutitemclick', function() {
	alert('hi');
});

appShortcuts.addDynamicShortcut({
	itemtype: "contact_us",
	title: "Contact Us",
	subtitle: "Tap to reach us",
	icon: Ti.UI.iOS.SHORTCUT_ICON_TYPE_ADD,
	userInfo: { infoKey: "contact_us" } // remove this line and I'll crash when used
});

Ti.UI.createWindow({
	backgroundColor: 'white'
}).open(); 
*Console*
[ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] Reason:
[ERROR] *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]
[ERROR] Stack trace:
[ERROR]
[ERROR] 0   CoreFoundation                      0x0000000183cccf48 <redacted> + 124
[ERROR] 1   libobjc.A.dylib                     0x0000000199177f80 objc_exception_throw + 56
[ERROR] 2   CoreFoundation                      0x0000000183bbb7c8 <redacted> + 324
[ERROR] 3   CoreFoundation                      0x0000000183bbb660 <redacted> + 64
[ERROR] 4   short                               0x0000000100161784 short + 1103748
[ERROR] 5   CoreFoundation                      0x0000000183c7260c <redacted> + 20
[ERROR] 6   CoreFoundation                      0x0000000183c71e2c <redacted> + 396
[ERROR] 7   CoreFoundation                      0x0000000183c71bac <redacted> + 60
[ERROR] 8   CoreFoundation                      0x0000000183cd7424 <redacted> + 1532
[ERROR] 9   CoreFoundation                      0x0000000183bb2714 _CFXNotificationPost + 368
[ERROR] 10  Foundation                          0x0000000184b22dcc <redacted> + 68
[ERROR] 11  short                               0x0000000100137b94 short + 932756
[ERROR] 12  short                               0x0000000100137dbc short + 933308
[ERROR] 13  UIKit                               0x000000018951bbc0 <redacted> + 208
[ERROR] 14  UIKit                               0x0000000189516e5c <redacted> + 2752
[ERROR] 15  UIKit                               0x000000018951d0c0 <redacted> + 2436
[ERROR] 16  UIKit                               0x000000018951c4c4 <redacted> + 448
[ERROR] 17  UIKit                               0x0000000189506f14 <redacted> + 152
[ERROR] 18  UIKit                               0x0000000189506b9c <redacted> + 708
[ERROR] 19  FrontBoardServices                  0x000000018de337c4 <redacted> + 184
[ERROR] 20  FrontBoardServices                  0x000000018de33b44 <redacted> + 56
[ERROR] 21  CoreFoundation                      0x0000000183c84544 <redacted> + 24
[ERROR] 22  CoreFoundation                      0x0000000183c83fd8 <redacted> + 540
[ERROR] 23  CoreFoundation                      0x0000000183c81cd8 <redacted> + 724
[ERROR] 24  CoreFoundation                      0x0000000183bb0ca0 CFRunLoopRunSpecific + 384
[ERROR] 25  GraphicsServices                    0x000000018f134088 GSEventRunModal + 180
[ERROR] 26  UIKit                               0x00000001892c8ffc UIApplicationMain + 204
[ERROR] 27  short                               0x000000010005afa8 short + 28584
[ERROR] 28  libdyld.dylib                       0x00000001999ba8b8 <redacted> + 4
[ERROR] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]'
[ERROR] *** First throw call stack:
[ERROR] (0x183cccf48 0x199177f80 0x183bbb7c8 0x183bbb660 0x100161784 0x183c7260c 0x183c71e2c 0x183c71bac 0x183cd7424 0x183bb2714 0x184b22dcc 0x100137b94 0x100137dbc 0x18951bbc0 0x189516e5c 0x18951d0c0 0x18951c4c4 0x189506f14 0x189506b9c 0x18de337c4 0x18de33b44 0x183c84544 0x183c83fd8 0x183c81cd8 0x183bb0ca0 0x18f134088 0x1892c8ffc 0x10005afa8 0x1999ba8b8)

Comments

  1. Hans Knöchel 2015-11-30

    Already fixed for 5.2.0 as part of TIDOC-2348.
  2. Fokke Zandbergen 2015-11-30

    Sneaky!
  3. Harry Bryant 2016-01-19

    Verified as fixed, excluding userInfo property no longer causes app crash with SDK 5.2.0.v20160114021251. Tested on: iPhone 6s Plus Device (9.2) Mac OSX El Capitan 10.11 (15A284) Ti SDK: 5.2.0.v20160114021251 Appc NPM: 4.2.2 App CLI: 5.2.0-220 Xcode 7.2 Node v4.2.3 *Closing ticket.*

JSON Source