iOS Question Porting Class Youtube from B4A to B4i

MarcoRome

Expert
Licensed User
Longtime User
I would like to make available the Youtube V3 class of the existing library currently in B4a (Library YouTube V3) in order to have a compatible class (B4X) for B4A / B4i.
The class works perfectly in the B4A environment but in B4i I have the following error:

Application_Start
Error occurred on line: 364 (youtube)
-[_searchvideo setDescription:]: unrecognized selector sent to instance 0x16572bc0
Stack Trace: (
CoreFoundation <redacted> + 152
libobjc.A.dylib objc_exception_throw + 38
CoreFoundation <redacted> + 0
CoreFoundation <redacted> + 696
CoreFoundation _CF_forwarding_prep_0 + 24
B4i Example -[_searchvideo Initialize] + 962
B4i Example -[b4i_youtube _searchvideo::::::::] + 1710
CoreFoundation <redacted> + 68
CoreFoundation <redacted> + 300
B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1784
B4i Example -[B4IShell runMethod:] + 590
B4i Example -[B4IShell raiseEventImpl:method:args::] + 2024
B4i Example -[B4IShellBI raiseEvent:event:params:] + 1578
B4i Example __33-[B4I raiseUIEvent:event:params:]_block_invoke + 74
libdispatch.dylib <redacted> + 10
libdispatch.dylib <redacted> + 22
libdispatch.dylib _dispatch_main_queue_callback_4CF + 902
CoreFoundation <redacted> + 8
CoreFoundation <redacted> + 848
CoreFoundation CFRunLoopRunSpecific + 470
CoreFoundation CFRunLoopRunInMode + 104
GraphicsServices GSEventRunModal + 80
UIKit UIApplicationMain + 150
B4i Example main + 106
libdyld.dylib <redacted> + 2
)
Application_Active

The code is:

B4X:
'Class module
Private Sub Class_Globals
 
   ....
     
    Type SearchVideo( _
       publishedAt(100) As String, title(100) As String, description(100) As String, _
      urlpicture(100) As String, urldefaultpicture(100) As String, urlmediumpicture(100) As String, idVideo(100) As String, totalResults As Int, TotalChannel As Int, _
      nextpage(100) As String, prevpage(100) As String )

......

    Private SVideo As SearchVideo
 
End Sub

Public Sub SearchVideo(maxresult As Int, search As String, order As String, regionCode As String, videoDuration As String, Module As Object, EventName As String )
  
    Dim su As StringUtils
    search = su.EncodeUrl(search, "UTF8")
  
    SVideo.Initialize  '<----- THE ERROR IS HERE
    If order = "" Then
        order = "relevance"
    End If
    If videoDuration = "" Then
        videoDuration = "any"
    End If
    If regionCode = "" Then
        Dim job1 As HttpJob
        job1.Initialize("searchvideo1", Me)
        job1.Download("https://www.googleapis.com/youtube/v3/search?part=id,snippet&order="& order &"&maxResults="& maxresult &"&videoDuration="& videoDuration &"&q="& search &"&key=" & keyvalue)
    Else
        Dim job1 As HttpJob
        job1.Initialize("searchvideo1", Me)
        job1.Download("https://www.googleapis.com/youtube/v3/search?part=id,snippet&order="& order &"&maxResults="& maxresult &"&videoDuration="& videoDuration &"&regionCode="& regionCode &"&q="& search &"&key=" & keyvalue)
    End If
'    Dim job1 As HttpJob
    '    job1.Initialize("search", Me)
'    job1.Download("https://www.googleapis.com/youtube/v3/search?part=id,snippet&maxResults="& maxresult &"&q="& search &"&key=" & keyvalue)
    'job1.GetRequest.SetHeader("Accept", "application/json")
    MN = Module
    EN = EventName
End Sub

upload_2018-1-13_9-47-59.png


Simply when i initialize
Any help ?
Thank you
Marco
 
Top