iOS Question iHttpUtils2 Problem

mmieher

Active Member
Licensed User
Geetings, Geniuses! Kinda new at B4i. Trying to port a B4a project. Have stripped it down to the bare minimum in an attempt to isolate the error.

After a clean, I get this error:

Unexpected event (missing RaisesSynchronousEvents): AFTER_SLEEP
Error occurred on line: 87 (HttpUtils2Service)
*** -[__NSSingleObjectArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]
Stack Trace: (
CoreFoundation <redacted> + 252
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation <redacted> + 0
ShopperMenu -[ResumableSub_jrdc_GetRDC resume::] + 2228
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
ShopperMenu +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
ShopperMenu -[B4IShell runMethod:] + 448
ShopperMenu -[B4IShell raiseEventImpl:method:args::] + 1648
ShopperMenu __40-[B4IShell raiseEventImpl:method:args::]_block_invoke + 36
libdispatch.dylib <redacted> + 24
libdispatch.dylib <redacted> + 16
libdispatch.dylib <redacted> + 1068
CoreFoundation <redacted> + 12
CoreFoundation <redacted> + 1964
CoreFoundation CFRunLoopRunSpecific + 436
GraphicsServices GSEventRunModal + 100
UIKitCore UIApplicationMain + 212
ShopperMenu main + 124
libdyld.dylib <redacted> + 4
)

However, if change anything in the code (like add a log statement) I get a different error.
Line 13 is a sub declaration: Public Sub GetRDC(ID As Int) As ResumableSub

Error occurred on line: 13 (jRDC)
*** -[__NSSingleObjectArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]
Stack Trace: (
CoreFoundation <redacted> + 252
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation <redacted> + 0
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
ShopperMenu +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
ShopperMenu -[B4IShell runMethod:] + 448
ShopperMenu -[B4IShell raiseEventImpl:method:args::] + 1648
ShopperMenu -[B4IShellBI raiseEvent:event:params:] + 1580
ShopperMenu -[B4IDebugResumableSub resume::] + 356
ShopperMenu -[B4I checkAndRunWaitForEvent:event:params:] + 552
ShopperMenu -[B4ICommon CallSubDebug4::::] + 488
ShopperMenu -[B4ICommon CallSubDebug2::::] + 360
ShopperMenu -[b4i_httpjob _complete::] + 768
ShopperMenu -[b4i_httputils2service _completejob::::] + 1288
ShopperMenu -[b4i_httputils2service _hc_responsesuccess::] + 636
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
ShopperMenu +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
ShopperMenu -[B4IShell runMethod:] + 448
ShopperMenu -[B4IShell raiseEventImpl:method:args::] + 2172

Main.bas
B4X:
Sub Process_Globals
    '    iOS Stuff -------------------------------------
    Public App As Application
    Public NavControl As NavigationController
   
    Public WebHost As String = "http://www.ShopperMenu.com/"
    Public jRDCHost As String = "http://www.ShopperMenu.com:17178/rdc"
   
    Public RDC As jRDC
    Type DBResult(Tag As Object, Columns As Map, Rows As List)
    Type DBCommand(Name As String, Parameters() As Object)
   
End Sub

Private Sub Application_Start (Nav As NavigationController)
    RDC.Initialize("MR")
    Wait For(RDC.GetRDC(21)) complete (Result As Int)
End Sub

jRDC Class
B4X:
Sub Class_Globals
    Dim req As DBRequestManager
    Dim Param As String
End Sub

Public Sub Initialize(inParam As String)
    Param = inParam
End Sub

Public Sub GetRDC(ID As Int) As ResumableSub
   
    Log("jRDC: GetRDCRecord ID is " & ID)
   
    Dim dbCmd As DBCommand
    dbCmd.Initialize
    dbCmd.name = "SelectCustomer"
    dbCmd.Parameters = Array As Object(Param)
   
    req = CreateRequest
    Dim j As HttpJob = req.ExecuteQuery(dbCmd,0,dbCmd.Name)
    Wait For(j) JobDone (j As HttpJob)
    If J.Success = False Then
        Return 0
    End If

    RDCJobDone(j)
   
    Return 0
   
End Sub

Public Sub CreateRequest As DBRequestManager
    Dim req As DBRequestManager
    req.Initialize(Me, Main.jRDCHost)
    Return req
End Sub

Sub RDCJobDone(Job As HttpJob)
    Log("JobDone Name " & Job.JobName)
    Log("JobDone Tag " & Job.tag)
 End Sub
 

Attachments

  • Test.zip
    189.9 KB · Views: 117
Top