Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1737] iOS: Modal window crashes on adding another view

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2013-09-16T09:54:48.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterSebastian Klaus
AssigneeShak Hossain
Created2013-09-16T09:29:18.000+0000
Updated2016-03-08T07:40:37.000+0000

Description

The application crashes on adding a view after complete loading of a modal window Error-Log: [ERROR] :  The application has crashed with an uncaught exception 'NSRangeException'. [ERROR] :  Reason: [ERROR] :  *** -[__NSArrayM objectAtIndex:]: index 5 beyond bounds [0 .. 4] [ERROR] :  Stack trace: [ERROR] :  0 CoreFoundation 0x03e5c012 __exceptionPreprocess + 178 [ERROR] :  1 libobjc.A.dylib 0x038a4e7e objc_exception_throw + 44 [ERROR] :  2 CoreFoundation 0x03dfe0b4 -[__NSArrayM objectAtIndex:] + 196 [ERROR] :  3 App 0x0007bc30 -[TiViewProxy insertSubview:forProxy:] + 1520 [ERROR] :  4 App 0x0007b568 -[TiViewProxy refreshView:] + 2232 [ERROR] :  5 App 0x0007c7c3 -[TiViewProxy layoutChildrenIfNeeded] + 259 [ERROR] :  6 App 0x002001d7 +[TiLayoutQueue layoutProxy:] + 87 [ERROR] :  7 App 0x001fffa2 performLayoutRefresh + 530 [ERROR] :  8 CoreFoundation 0x03e1b376 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22 [ERROR] :  9 CoreFoundation 0x03e1ae06 __CFRunLoopDoTimer + 534 [ERROR] :  10 CoreFoundation 0x03e02a82 __CFRunLoopRun + 1810 [ERROR] :  11 CoreFoundation 0x03e01f44 CFRunLoopRunSpecific + 276 [ERROR] :  12 CoreFoundation 0x03e01e1b CFRunLoopRunInMode + 123 [ERROR] :  13 GraphicsServices 0x040947e3 GSEventRunModal + 88 [ERROR] :  14 GraphicsServices 0x04094668 GSEventRun + 104 [ERROR] :  15 UIKit 0x01302ffc UIApplicationMain + 1211 [ERROR] :  16 App 0x00007918 main + 456 [ERROR] :  17 App 0x00002fd5 start + 53 [ERROR] :  2013-09-16 11:11:24.898 App[31924:c07] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 5 beyond bounds [0 .. 4]' [ERROR] :  *** First throw call stack: [ERROR] :  (0x3e5c012 0x38a4e7e 0x3dfe0b4 0x7bc30 0x7b568 0x7c7c3 0x2001d7 0x1fffa2 0x3e1b376 0x3e1ae06 0x3e02a82 0x3e01f44 0x3e01e1b 0x40947e3 0x4094668 0x1302ffc 0x7918 0x2fd5) -- End simulator log ---------------------------------------------------------

Comments

  1. Mostafizur Rahman 2013-09-16

    Hello Sebastian Klaus, Can you post some code with test case? Thanks
  2. Sebastian Klaus 2013-09-18

    Sorry, code is too complicated to extract. But found out, that a view on a modal window on iPad could not be added with a zIndex
  3. Mostafizur Rahman 2013-12-14

    We tried to reproduce this issue with the test code below but the test case ran fine with Titanium SDK 3.2.0.v20131209192649. I would appreciate if you can give your application a try with the latest 3.2.0 SDK or provide a simple test case to reproduce the problem. Environment: OSX Version 10.8.5 and 10.9 Titanium Studio, build: 3.1.3.201309132423 Ti CLI 3.1.2, 3.2.0-cr3 Titanium SDK: 3.1.3.GA, 3.2.0.v20131209192649 iOS Simulator 7.0

    Test Code

        var root = Titanium.UI.createWindow({
       	backgroundColor : "#269"
       });
       
       // create a system add button
       
       var add = Titanium.UI.createButton({
       	systemButton : Titanium.UI.iPhone.SystemButton.ADD
       });
       
       // create another window and add system add button
       
       var appWin = Titanium.UI.createWindow({
       	backgroundColor : "red",
       	title : "App",
       	rightNavButton : add
       });
       
       // Create Navigatio group
       
       var nav = Ti.UI.iPhone.createNavigationGroup({
       	window : appWin
       })
       root.add(nav);
       
       // Event listner for displaying
       add.addEventListener('click', function(e) {
       
       	// Create a modal window
       
       	var w = Titanium.UI.createWindow({
       		backgroundColor : 'orange',
       		title : 'Modal',
       		modal : true,
       		layout: 'vertical'
       	});
       
       	// create a view
       
       	var view = Titanium.UI.createView({
       		backgroundColor : 'black',
       		color : 'white',
       		width : '70%',
       		height: 200,
       	});
       
       	// Create a Label.
       	var label = Ti.UI.createLabel({
       		text : 'Add view in a modal window',
       		textAlign : 'center',
       		color : 'white'
       	});
       
       	// Add to the parent view.
       	var view1 = Titanium.UI.createView({
       		backgroundColor : '#fff',
       		color : 'white',
       		width : '70%',
       		
       		height: 200,
       		top : 20,
       	});
       
       	view.add(label);
       	w.add(view);
       	w.add(view1);
       	w.open();
       
       });
       
       root.open();
       
       
       

JSON Source