iOS Question Posting to Facebook

GEoffT

Member
Licensed User
Longtime User
I have scoured the Forum and tried several things, but still can't post to Facebook in B4i. Had no problems in B4a.

I have tried the both ways in the code below

first method gives me
-canOpenURL: failed for URL: "(null)" - error: "Invalid input URL"
second does nothing

Any help gratefully received

B4X:
            Dim su As StringUtils
            Dim s As String
           
            s= "fb://publish/profile/#me?text=iphone Test"
            Dim app As Application
            If app.CanOpenUrl(s) Then
                app.OpenUrl(s)
                Log ("s = " & s)
            Else
                Dim mhud As HUD
                mhud.ToastMessageShow(s,True)
            End If

'  OR

            Dim WebView1 As WebView
            WebView1.Initialize("webface")
            WebView1.LoadHtml("<a href='https://www.facebook.com/sharer/sharer.php?u=encodedurl&t=encodedtext'>iphone test</a>")
 

GEoffT

Member
Licensed User
Longtime User
Yes I have Erel. I get the following message logged.

-canOpenURL: failed for URL: "(null)" - error: "Invalid input URL"
 
Upvote 0

GEoffT

Member
Licensed User
Longtime User
Sorry Erel, I think I am being stupid.......

I am trying the similar as above with Twitter (code below) .

I didn't think I needed a #QueriesSchemes for https and yet app.CanOpenUrl is returning false

B4X:
        Case "T"
            Dim s As String
            Dim su As StringUtils
            s= $"https://twitter.com/intent/tweet?text=${su.EncodeUrl(message, "UTF8")}"$
       
            Log ("s = " & s)
            If app.CanOpenUrl(s ) Then
                app.OpenURL(s)
            Else
                Dim mhud As HUD
                mhud.ToastMessageShow(s ,True)
                Log ("s = " & s)
            End If
 
Upvote 0
Top