iOS Question TMS-90809: Deprecated API Usage (UIWEBVIEW)

MarcoRome

Expert
Licensed User
Longtime User
The problem would seem to be solved if you use WKWebView.

You found WKWebView in Ui8 library ( https://www.b4x.com/android/forum/threads/iui8-library.63004/ )


upload_2019-8-30_16-59-20.png


Try replacing your UIWebView with WKWebView
 
Upvote 0

Fabio Campanella

Member
Licensed User
Longtime User
I've a custom class (not custom view) that use a WebView.
Now, with WKWebView I must use the designer and don't can use several classes that contains own WebView with their own events etc.

I Have this comfortable and useful class:

B4X:
Sub Class_Globals
  
   Private WF As WebView
   'Private WE As WebViewExtras
   'Private WX As WebViewSettings
   Private VARS() As String
   Private CurrentURL As String
   Private CurrentVARS As String
  
   Private mHandler As Object
   Private mEventName As String
   Private mHtmlCode As String
   Private mDefaultHtmlCode As String
  
   Private mPnl As Panel
   Private mWidth As Int
   Private mHeight As Int
   Private mTop As Int
   Private mLeft As Int
   Private SU As StringUtils
   Private mTag As Object
   Private mTagID As Object
   Private mEnableExternalLinks As Boolean = False
  
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize( pPnl As Panel, pHandler As Object, pEventName As String, pLeft As Int, pTop As Int, pWidth As Int, pHeight As Int, pDefaultHtmlCode As String)

   mHandler = pHandler
   mEventName = pEventName
   mPnl = pPnl
   mLeft = pLeft
   mTop = pTop
   mWidth = pWidth
   mHeight = pHeight
  
   mDefaultHtmlCode= pDefaultHtmlCode
      
   WF.Initialize("WF")
   Dim Ntv5 As NativeObject = WF
   'Ntv5.SetField("opaque", False)
   Ntv5.GetField("scrollView").SetField("bounces", False)
   'WF.setzo
   'WF.ZoomEnabled = False
   'WE.Initialize(WF)
   'WE.ZoomEnabled = False
   'WX.setSupportZoom(WF, False)
      
   WF.LoadHtml(mDefaultHtmlCode)
  
   mPnl.AddView(WF, mLeft, mTop, mWidth, mHeight)
  
End Sub

public Sub AsView As WebView
   Return WF
End Sub

Public Sub getEnableExternalLinks As Boolean
   Return mEnableExternalLinks
End Sub

Public Sub setEnableExternalLinks(v As Boolean)
   mEnableExternalLinks = v
End Sub

private Sub WF_PageFinished (Success As Boolean, Url As String)
   If SubExists(mHandler, mEventName & "_Loaded",0) And Success = True Then
       CallSub(mHandler, mEventName & "_Loaded")
   End If
End Sub

Private Sub WF_OverrideUrl(Url As String) As Boolean
  
   If mEnableExternalLinks = True Then
      
       If Url.IndexOf("http://") = 0 Or Url.IndexOf("https://") = 0  Then ' è un link esterno
           If SubExists(mHandler, mEventName & "_RaiseExternalLink",1) Then
               CallSub2(mHandler, mEventName & "_RaiseExternalLink", Url)
           End If
           Return True
       End If
   End If
  
   CurrentURL = SU.DecodeUrl(Url, "utf-8")
   Dim nu As String = SU.DecodeUrl(Url, "utf-8")
   Dim iPos As Int = nu.IndexOf("/par?")
   nu = nu.SubString(iPos+5)
   VARS = Regex.Split("&",nu)
   CurrentVARS = nu
  
   If SubExists(mHandler, mEventName & "_Raise",0) Then
       CallSub(mHandler, mEventName & "_Raise")
   End If
      
   Return True
End Sub

public Sub LoadHtml(pHtmlCode As String)
   mHtmlCode = pHtmlCode
   If mHtmlCode.IndexOf("///")>0 Then
       mHtmlCode = mHtmlCode.Replace("/android_asset", File.DirAssets)
   Else
       mHtmlCode = mHtmlCode.Replace("android_asset", File.DirAssets)
   End If
   WF.LoadHtml(mHtmlCode)
End Sub

public Sub LoadHtmlFromRemoteUrl(pRemoteUrl As String, pVars() As String, pPostMode As Boolean)
  
   WF.LoadHtml(mDefaultHtmlCode)
  
   Dim j As HttpJob
   j.Initialize("jWS", Me)
  
   Dim xx As String
   For i = 0 To pVars.Length -1
       If xx <> "" Then xx = xx & "&"
       xx = xx & pVars(i)
   Next
  
   If pPostMode = True Then
       Dim bc As ByteConverter
       Dim Data() As Byte = bc.StringToBytes(xx, "utf-8")
       j.PostBytes(pRemoteUrl, Data)
       j.GetRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8")
   Else
       j.PostString(pRemoteUrl, xx)
   End If

End Sub

public Sub ExecuteJavaScript(l() As Object)
   Dim no As NativeObject = WF  
   no.RunMethod("stringByEvaluatingJavaScriptFromString:", l)
End Sub

public Sub setWebBackground(color As Int)
   WF.Color = color
End Sub

Private Sub JobDone(j As HttpJob)
   If j.Success Then
       mHtmlCode = j.GetString2("utf-8")
      
       ' Cambia android_asset
       If mHtmlCode.IndexOf("///")>0 Then
           mHtmlCode = mHtmlCode.Replace("/android_asset", File.DirAssets)
       Else
           mHtmlCode = mHtmlCode.Replace("android_asset", File.DirAssets)
       End If  
      
       WF.LoadHtml(mHtmlCode)
   End If
   j.Release
End Sub

public Sub getTag As Object
   Return mTag
End Sub

public Sub setTag(pTag As Object)
   mTag = pTag
End Sub

public Sub getTagID As Object
   Return mTagID
End Sub

public Sub setTagID(pTag As Object)
   mTagID = pTag
End Sub

public Sub GetVars As String()
   Return VARS
End Sub

public Sub GetValue( varName As String ) As String
   Dim sRet As String = ""
   If VARS.Length > 0 Then
       For i = 0 To VARS.Length -1
           Dim data() As String = Regex.Split("=", VARS(i))
           If data.Length = 2 Then
               If varName.ToLowerCase() = data(0).ToLowerCase() Then
                   sRet = data(1)
                   Exit
               End If
           End If
       Next
   End If
   Return sRet
End Sub

#End if

How can I use it with the WKWebView? :(
 
Upvote 0

Fabio Campanella

Member
Licensed User
Longtime User
Hi everyone,
I created a custom library that uses WKWebView without Designer and works perfectly. I totally deleted any reference to UIWebView but the problem persists.
nobody has the same problem?

This apple problem started it only 2 or 3 days ago. In my opinion there are many third-party libraries that use UIWebView ... wandering on the net this problem is literally exploding ... I believe it is right to have the maximum attention.

I use:
iFirebaseAnalitycs
iFirebaseNotifications
iLoadIndicatorView
iBarCode

in one or more of these there is the reference to UIWebView

Ps. I attack this "suspicius" link: https://github.com/firebase/firebase-ios-sdk/pull/3723
 
Last edited:
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Just sent to TestFlight. I also had two pages with "WebView" and changed to WKWebView. App Store Connect informs about "ITMS-90809 Missing Purpose String in info.plist" and ITMS-90809 anyway.

I think the probem in iCore library. Unlike we do not use UIWebView, iCore has a link to UIWebView class (exactly this AppStore detects)
 
Upvote 0
Top