[AC-4462] Set an empty view backgroundImage crash the application
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2016-09-19T20:48:23.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | ios |
Reporter | nicolomonili |
Assignee | Shak Hossain |
Created | 2016-09-15T09:15:45.000+0000 |
Updated | 2016-09-19T20:48:23.000+0000 |
Description
I can't reproduce the problem with a test project , but i'm pretty sure that the problem is due to the fact that i change the backgroundImage property of a view in this way
myview.backgroundImage = "";
My app is very complex, but commenting the line of code where i edit the backgroundImage property the app no longer crashes.
Has anyone ever had problems of this kind?
This issue can help (http://stackoverflow.com/questions/36427020/appcelerator-bomstream-bomstreamwithfileandsysint-off-t-size-t-int-char) ?
This is the crash error (is always the same , in different points of the app)
[ERROR] : The application has crashed with an uncaught exception 'NSRangeException'.
[ERROR] : Reason:
[ERROR] : *** -[__NSCFString substringFromIndex:]: Index 180 out of bounds; string length 179
[ERROR] : Stack trace:
[ERROR] :
[ERROR] : 0 CoreFoundation 0x067991f0 __exceptionPreprocess + 160
[ERROR] : 1 libobjc.A.dylib 0x05e0ee66 objc_exception_throw + 52
[ERROR] : 2 CoreFoundation 0x0680af15 +[NSException raise:format:] + 133
[ERROR] : 3 Foundation 0x017acc52 -[NSString substringFromIndex:] + 113
[ERROR] : 4 App Name 0x000adbbb +[TiUtils loadAppResource:] + 331
[ERROR] : 5 App Name 0x001faf6c -[LocalProtocolHandler startLoading] + 412
[ERROR] : 6 CFNetwork 0x03e9dad6 ___ZN16CFURLProtocol_NS28_protocolInterface_startLoadEPK20_CFCachedURLResponse_block_invoke + 288
[ERROR] : 7 libdispatch.dylib 0x08c806ef _dispatch_client_callout + 14
[ERROR] : 8 libdispatch.dylib 0x08c61e14 _dispatch_block_invoke_direct + 347
[ERROR] : 9 libdispatch.dylib 0x08c7de04 ___dispatch_block_create_block_invoke + 20
[ERROR] : 10 CFNetwork 0x03d6ab6e _ZN19RunloopBlockContext13_invoke_blockEPKvPv + 24
[ERROR] : 11 CoreFoundation 0x066e3ef9 CFArrayApplyFunction + 57
[ERROR] : 12 CFNetwork 0x03d6aa69 _ZN19RunloopBlockContext7performEv + 139
[ERROR] : 13 CFNetwork 0x03e70ebc _ZThn16_N19RunloopBlockContext24multiplexerClientPerformEv + 20
[ERROR] : 14 CFNetwork 0x03d6a905 _ZN17MultiplexerSource7performEv + 319
[ERROR] : 15 CFNetwork 0x03d6a724 _ZN17MultiplexerSource8_performEPv + 62
[ERROR] : 16 CoreFoundation 0x06738cbf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
[ERROR] : 17 CoreFoundation 0x0671cdf7 __CFRunLoopDoSources0 + 519
[ERROR] : 18 CoreFoundation 0x0671c284 __CFRunLoopRun + 1124
[ERROR] : 19 CoreFoundation 0x0671bbab CFRunLoopRunSpecific + 395
[ERROR] : 20 CoreFoundation 0x0671ba0b CFRunLoopRunInMode + 123
[ERROR] : 21 CFNetwork 0x04013cb8 _ZL27_privateRunloopEmulationSetPv + 246
[ERROR] : 22 libsystem_pthread.dylib 0x08ff9780 _pthread_body + 138
[ERROR] : 23 libsystem_pthread.dylib 0x08ff96f6 _pthread_body + 0
[ERROR] : 24 libsystem_pthread.dylib 0x08ff6f7a thread_start + 34
[ERROR] :
[ERROR] : 2016-09-15 10:57:28.699 App Name[20463:141440] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSCFString substringFromIndex:]: Index 180 out of bounds; string length 179'
[ERROR] : *** First throw call stack:
[ERROR] : (
[ERROR] : 0 CoreFoundation 0x06799212 __exceptionPreprocess + 194
[ERROR] : 1 libobjc.A.dylib 0x05e0ee66 objc_exception_throw + 52
[ERROR] : 2 CoreFoundation 0x0680af15 +[NSException raise:format:] + 133
[ERROR] : 3 Foundation 0x017acc52 -[NSString substringFromIndex:] + 113
[ERROR] : 4 App Name 0x000adbbb +[TiUtils loadAppResource:] + 331
[ERROR] : 5 App Name 0x001faf6c -[LocalProtocolHandler startLoading] + 412
[ERROR] : 6 CFNetwork 0x03e9dad6 ___ZN16CFURLProtocol_NS28_protocolInterface_startLoadEPK20_CFCachedURLResponse_block_invoke + 288
[ERROR] : 7 libdispatch.dylib 0x08c806ef _dispatch_client_callout + 14
[ERROR] : 8 libdispatch.dylib 0x08c61e14 _dispatch_block_invoke_direct + 347
[ERROR] : 9 libdispatch.dylib 0x08c7de04 ___dispatch_block_create_block_invoke + 20
[ERROR] : 10 CFNetwork 0x03d6ab6e _ZN19RunloopBlockContext13_invoke_blockEPKvPv + 24
[ERROR] : 11 CoreFoundation 0x066e3ef9 CFArrayApplyFunction + 57
[ERROR] : 12 CFNetwork 0x03d6aa69 _ZN19RunloopBlockContext7performEv + 139
[ERROR] : 13 CFNetwork 0x03e70ebc _ZThn16_N19RunloopBlockContext24multiplexerClientPerformEv + 20
[ERROR] : 14 CFNetwork 0x03d6a905 _ZN17MultiplexerSource7performEv + 319
[ERROR] : 15 CFNetwork 0x03d6a724 _ZN17MultiplexerSource8_performEPv + 62
[ERROR] : 16 CoreFoundation 0x06738cbf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
[ERROR] : 17 CoreFoundation 0x0671cdf7 __CFRunLoopDoSources0 + 519
[ERROR] : 18 CoreFoundation 0x0671c284 __CFRunLoopRun + 1124
[ERROR] : 19 CoreFoundation 0x0671bbab CFRunLoopRunSpecific + 395
[ERROR] : 20 CoreFoundation 0x0671ba0b CFRunLoopRunInMode + 123
[ERROR] : 21 CFNetwork 0x04013cb8 _ZL27_privateRunloopEmulationSetPv + 246
[ERROR] : 22 libsystem_pthread.dylib 0x08ff9780 _pthread_body + 138
[ERROR] : 23 libsystem_pthread.dylib 0x08ff96f6 _pthread_body + 0
[ERROR] : 24 libsystem_pthread.dylib 0x08ff6f7a thread_start + 34
[ERROR] : )
[ERROR] : libc++abi.dylib: terminating with uncaught exception of type NSException
With SDK 5.4.0.G.A and 5.5.0.G.A the app crash.
With SDK 5.3.1.G.A the app doesn't crash
Hello, When backgroundImage is specified, you have to provide a local file path or URL. Default behavior, when
backgroundImage
is unspecified depends on the type of view and the platform. For generic views, no image is used. For most controls (buttons, text fields, and so on), platform-specific default images are used. Reference: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.View-property-backgroundImage. So, Assign an image to the property. Thanks.So , the crash can be related to this ==> view.backgroundImage = ""; ? Because from the crash log i don't understand what can cause the problem
Yes, Leaving "backgroundImage" as blank, is the cause of the error. You have to provide an image path or link. Thanks.
Ok , problem solved. Maybe it would be better to specify in the docs that this property can't be empty.