iOS Question [NSConcreteMutableData initWithLength:]: absurd length. Please explain

tsteward

Well-Known Member
Licensed User
Longtime User
So I have started a new app. Use the hosted server.
This app was running fine on my iPhone.
I went and had a coffee then came back and run again but now it keeps crashing, but I didn't change anything.
I tried cleaning the project but same result
Application_Start
Checking and copying DB if needed
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
Error occurred on line: 58 (B4XMainPage)
*** -[NSConcreteMutableData initWithLength:]: absurd length: 18446744073709540416, maximum size: 9223372036854775808 bytes
Stack Trace: (
CoreFoundation <redacted> + 252
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation <redacted> + 0
Foundation <redacted> + 116
iLARA -[B4IArray initBytes:] + 180
iLARA -[b4i_bitmapcreator _initialize:::] + 448
iLARA -[b4i_gradientbackground _generategradient::::::] + 196
iLARA -[b4i_gradientbackground _generategradientrounded:::::::] + 584
iLARA -[b4i_xgridlistview _additem::] + 1412
iLARA -[b4i_xgridlistview _addwithimage::::::] + 440
iLARA -[ResumableSub_b4xmainpage_B4XPage_Created resume::] + 3576
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
iLARA +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1296
iLARA -[B4IShell runMethod:] + 420
iLARA -[B4IShell raiseEventImpl:method:args::] + 1968
iLARA -[B4IShellBI raiseEvent:event:params:] + 1360
iLARA -[B4IDelegatableResumableSub resume::] + 376
iLARA -[B4I checkAndRunWaitForEvent:event:params:] + 440
iLARA -[B4IShellBI raiseEvent:event:params:] + 1216
iLARA __37-[B4ICommon ReturnFromResumableSub::]_block_invoke + 248
libdispatch.dylib <redacted> + 24
libdispatch.dylib <redacted> + 16
libdispatch.dylib <redacted> + 1068
CoreFoundation <redacted> + 12
CoreFoundation <redacted> + 1924
CoreFoundation CFRunLoopRunSpecific + 436
GraphicsServices GSEventRunModal + 104
UIKitCore UIApplicationMain + 212
iLARA main + 100
libdyld.dylib <redacted> + 4
)
Application_Active
 

jahswant

Well-Known Member
Licensed User
Longtime User
*** -[NSConcreteMutableData initWithLength:]: absurd length: 18446744073709540416, maximum size: 9223372036854775808 bytes
seem you have a huge varable !
 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
*** -[NSConcreteMutableData initWithLength:]: absurd length: 18446744073709540416, maximum size: 9223372036854775808 bytes
seem you have a huge varable !
No I don't but just trying to load xGridListView with a few items
B4X:
'----Shortcuts----
    xGridLVShortCuts.SetCol(2)
    xGridLVShortCuts.ItemWidth=(xGridLVShortCuts.Width/2)-35dip
    xGridLVShortCuts.AddWithImage("Cars","","",1,xui.LoadBitmap(File.DirAssets,"sc-car.gif"),True)
    xGridLVShortCuts.AddWithImage("Bikes","","",2,xui.LoadBitmap(File.DirAssets,"sc-bike.gif"),True)
    xGridLVShortCuts.AddWithImage("Trucks","","",3,xui.LoadBitmap(File.DirAssets,"sc-truck.gif"),True)
    xGridLVShortCuts.AddWithImage("Tools","Decoding tools","",4,xui.LoadBitmap(File.DirAssets,"sc-lishi.png"),True)
    xGridLVShortCuts.AddWithImage("Codes","Bitting from Key Code","",5,xui.LoadBitmap(File.DirAssets,"sc-codes.png"),True)
 
Upvote 0

emexes

Expert
Licensed User
Longtime User
just trying to load xGridListView with a few items

My first guess would be to make sure that .ItemWidth isn't being set to a negative value:

B4X:
'----Shortcuts----
    xGridLVShortCuts.SetCol(2)
    xGridLVShortCuts.ItemWidth=(xGridLVShortCuts.Width/2)-35dip
    xGridLVShortCuts.AddWithImage("Cars","","",1,xui.LoadBitmap(File.DirAssets,"sc-car.gif"),True)
    xGridLVShortCuts.AddWithImage("Bikes","","",2,xui.LoadBitmap(File.DirAssets,"sc-bike.gif"),True)
    xGridLVShortCuts.AddWithImage("Trucks","","",3,xui.LoadBitmap(File.DirAssets,"sc-truck.gif"),True)
    xGridLVShortCuts.AddWithImage("Tools","Decoding tools","",4,xui.LoadBitmap(File.DirAssets,"sc-lishi.png"),True)
    xGridLVShortCuts.AddWithImage("Codes","Bitting from Key Code","",5,xui.LoadBitmap(File.DirAssets,"sc-codes.png"),True)
 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
So I have added even more to this app and it has compiled and run maybe 8 times now without changing any code I get the above error again.

I have cleaned the project. Sometimes this helps sometimes not.

It's making writing a program almost impossible.
 
Upvote 0
Top