Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19866] iOS: PreviewContext with no previews crashes or freezes app

GitHub Issuen/a
TypeImprovement
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2015-11-04T22:22:37.000+0000
Affected Version/sRelease 5.1.0
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterFokke Zandbergen
AssigneeHans Knöchel
Created2015-11-04T13:50:44.000+0000
Updated2017-03-21T18:38:00.000+0000

Description

When you have no preview property set for the preview context then the app will crash or - what I saw in the 3D touch app - it will freeze showing the blur effect. Of course the developer should know it needs a preview, but now we have peek/pop events its easy to make the assumption you could set the preview from the peek-event. So it would be a better dev experience if we provide better feedback then this crash.
var win = Ti.UI.createWindow({
	backgroundColor: "white"
});

var button = Ti.UI.createButton({
	previewContext: Ti.UI.iOS.createPreviewContext({
		// preview: Ti.UI.createView({backgroundColor: 'green'})
	}),
	title: "Open Window!",
	backgroundColor: "#A6171C",
	width: 200,
	height: 50,
	tintColor: "#fff"
});

win.add(button);
win.open();
*log*
[ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] Reason:
[ERROR] *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
[ERROR] Stack trace:
[ERROR]
[ERROR] 0   CoreFoundation                      0x0000000183a58f48 <redacted> + 124
[ERROR] 1   libobjc.A.dylib                     0x0000000198f03f80 objc_exception_throw + 56
[ERROR] 2   CoreFoundation                      0x00000001839477c8 <redacted> + 324
[ERROR] 3   CoreFoundation                      0x0000000183947660 <redacted> + 64
[ERROR] 4   theme                               0x000000010008c7dc theme + 460764
[ERROR] 5   UIKit                               0x0000000189373d7c <redacted> + 248
[ERROR] 6   UIKit                               0x0000000189628d4c <redacted> + 224
[ERROR] 7   UIKit                               0x0000000189629848 <redacted> + 136
[ERROR] 8   UIKit                               0x000000018962a8c0 <redacted> + 100
[ERROR] 9   UIKit                               0x0000000189567330 <redacted> + 164
[ERROR] 10  UIKit                               0x0000000189190b5c <redacted> + 172
[ERROR] 11  UIKit                               0x000000018901e85c <redacted> + 784
[ERROR] 12  UIKit                               0x000000018956870c <redacted> + 72
[ERROR] 13  UIKit                               0x0000000188fdd8b8 <redacted> + 372
[ERROR] 14  UIKit                               0x0000000188fda63c <redacted> + 2404
[ERROR] 15  UIKit                               0x000000018901c6cc <redacted> + 1132
[ERROR] 16  UIKit                               0x000000018901bcc8 <redacted> + 764
[ERROR] 17  UIKit                               0x0000000188fec4a4 <redacted> + 248
[ERROR] 18  UIKit                               0x0000000188fea76c <redacted> + 5528
[ERROR] 19  CoreFoundation                      0x0000000183a10544 <redacted> + 24
[ERROR] 20  CoreFoundation                      0x0000000183a0ffd8 <redacted> + 540
[ERROR] 21  CoreFoundation                      0x0000000183a0dcd8 <redacted> + 724
[ERROR] 22  CoreFoundation                      0x000000018393cca0 CFRunLoopRunSpecific + 384
[ERROR] 23  GraphicsServices                    0x000000018eec0088 GSEventRunModal + 180
[ERROR] 24  UIKit                               0x0000000189054ffc UIApplicationMain + 204
[ERROR] 25  theme                               0x0000000100020de8 theme + 19944
[ERROR] 26  libdyld.dylib                       0x00000001997468b8 <redacted> + 4
[ERROR] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
[ERROR] *** First throw call stack:
[ERROR] (0x183a58f48 0x198f03f80 0x1839477c8 0x183947660 0x10008c7dc 0x189373d7c 0x189628d4c 0x189629848 0x18962a8c0 0x189567330 0x189190b5c 0x18901e85c 0x18956870c 0x188fdd8b8 0x188fda63c 0x18901c6cc 0x18901bcc8 0x188fec4a4 0x188fea76c 0x183a10544 0x183a0ffd8 0x183a0dcd8 0x18393cca0 0x18eec0088 0x189054ffc 0x100020de8 0x1997468b8)

Comments

  1. Hans Knöchel 2015-11-04

    PR: https://github.com/appcelerator/titanium_mobile/pull/7403
  2. Angel Petkov 2015-11-04

    FT approved , merging. Thank Hans.
  3. Lee Morris 2017-03-21

    Closing ticket as fixed.

JSON Source