iOS Question [SOLVED] OBJC blows up when try to pass numeric parameter


Well-Known Member
Licensed User
Longtime User

I've spent several hours and lost a lot of what little hair I have left trying to sort this.

This simple little test code:
'Code module
#Region  Project Attributes
    #ApplicationLabel: B4i Example
    #Version: 1.0.0
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
    #Target: iPhone, iPad
    #MinVersion: 7
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)
    Dim no As NativeObject = Me
    no.RunMethod("test1", Null)
    no.RunMethod("test2", Array(1))
End Sub

Private Sub Application_Background
End Sub

- (void) test1
- (void) test2:(NSNumber *)testval
#End If
compiles OK but blows up badly when run:
Error occurred on line: 31 (Main)
Method not found: test2, target: <b4i_main: (null)>
Stack Trace: (
  CoreFoundation       <redacted> + 150
  libobjc.A.dylib      objc_exception_throw + 38
  CoreFoundation       <redacted> + 0
  B4i Example          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 426
  B4i Example          -[B4INativeObject RunMethod::] + 164
  B4i Example          -[b4i_main _page1_resize::] + 1574
  CoreFoundation       <redacted> + 68
  CoreFoundation       <redacted> + 292
  B4i Example          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1786
  B4i Example          -[B4IShell runMethod:] + 574
B4i Example          -[B4IShell raiseEventImpl:method:args::] + 1998
B4i Example          -[B4IShellBI raiseEvent:event:params:] + 1442
B4i Example          +[B4IObjectWrapper raiseEvent:::] + 220
B4i Example          __30-[B4IPanelView layoutSubviews]_block_invoke + 1034
libdispatch.dylib    <redacted> + 10
libdispatch.dylib    <redacted> + 22
libdispatch.dylib    <redacted> + 1524
CoreFoundation       <redacted> + 8
CoreFoundation       <redacted> + 1574
CoreFoundation       CFRunLoopRunSpecific + 520
CoreFoundation       CFRunLoopRunInMode + 108
GraphicsServices     GSEventRunModal + 160
UIKit                UIApplicationMain + 144
B4i Example          main + 108
libdyld.dylib        <redacted> + 2
I'm obviously doing something stupid but I can't see it.

Any help appreciated...


Well-Known Member
Licensed User
Longtime User

Well I knew it would be something stupid - but not that stupid!

Many thanks...
Upvote 0