iOS Question SD FlexGrid SetRowsHeights and ClearRows methods crash

I am using SD FlexGrids in a cross platform B4X application for Android and IOS.
The SetRowsHeights and ClearRows methods work perfectly in Android but crash in IOS.

The SetRowsHeights method causes an error when attempting to load the app onto the iPhone.
The code compiles fine but the build fails with the following:

Error: ** BUILD FAILED **
The following build commands failed:
CompileC /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_page_roundselect.o /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_page_roundselect.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'B4iProject' from project 'B4iProject')
(1 failure)

If I comment the line of code using the SetRowsHeights method then it compiles and builds onto the iPhone without an issue.

What happens now though is that a run time error occurs when the FlexGrid has some rows in it and then then ClearRows method is called.
Running in debug, the error in the log pane is:

Error occurred on line: 58 (Page_RoundSelect)
*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array
Stack Trace: (
CoreFoundation <redacted> + 252
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation _CFArgv + 0
CoreFoundation <redacted> + 188
GM Mobile -[B4IList Get:] + 80
GM Mobile -[b4i_flexgrid _selectviewer] + 620
GM Mobile -[ResumableSub_flexgrid_CreateGrid resume::] + 1956
GM Mobile -[b4i_flexgrid _creategrid::] + 172
GM Mobile -[b4i_flexgrid _invalidate] + 308
GM Mobile -[b4i_flexgrid _clearrows] + 208
GM Mobile -[b4i_page_roundselect _loadrounds::] + 436
GM Mobile -[ResumableSub_page_roundselect_SelectRound resume::] + 456
GM Mobile -[b4i_page_roundselect _selectround::] + 420
GM Mobile -[ResumableSub_b4xmainpage_populateRoundDetails resume::] + 2016
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
GM Mobile +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1400
GM Mobile -[B4IShell runMethod:] + 420
GM Mobile -[B4IShell raiseEventImpl:method:args::] + 1968
GM Mobile -[B4IShellBI raiseEvent:event:params:] + 1360
GM Mobile -[B4IDelegatableResumableSub resume::] + 376
GM Mobile -[B4I checkAndRunWaitForEvent:event:params:] + 472
GM Mobile -[B4IShellBI raiseEvent:event:params:] + 1216
GM Mobile __37-[B4ICommon ReturnFromResumableSub::]_block_invoke + 276
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
GM Mobile main + 100
libdyld.dylib <redacted> + 4
)

If I comment out the line of code using the ClearRows method then apart from the grid not being cleared, everything else works fine.

I have also found that the SetHeadHeight and RemoveRow methods produce the same errors respectively.

I have tested this on two different development computers using two different iPhones,
This appears to be a bug in the SD FlexGrid library.

Would appreciate Star-Dust having a look at this.

Thankyou
 
Unfortunately I have had to move on and replace the SD FlexGrids with Custom list views. It's a pity because if it wasn't for the inability to set row heights in code and clear the grid for re-loading in IOS without crashing, then it would have been perfect.
The Custom list view is a lot more work to set up as a multi column grid but it works properly across all platforms.
 
Upvote 0
Top