Welcome! › Forums › Unity Plugins › In-App Web Browser › iOS issue
- This topic has 9 replies, 2 voices, and was last updated 5 years, 8 months ago by MeMyself.
-
AuthorPosts
-
January 21, 2019 at 10:20 am #1318MeMyselfParticipant
When I use the plugin, it works the first time on iOs, but after some tries the page stays blank.
I don’t know if it’s a cache issue or DontDestroyOnLoad…
Once the page is blank it will do it each time.(no loading animation, no error message in the console)
It seems to occur only on iOS
Any help appreciated.January 21, 2019 at 10:49 am #1319PiotrKeymasterIs it happening with every website?
January 21, 2019 at 11:03 am #1320MeMyselfParticipantI don’t know. I’m just linking different wikipedia articles “https://wikipedia.org/wiki/Example”
January 21, 2019 at 8:46 pm #1321PiotrKeymasterAre you getting anything in
onBrowserFinishedLoadingWithError
callback?January 30, 2019 at 2:05 pm #1339MeMyselfParticipantI tried to implement the callback but keep getting “SendMessage: object InAppBrowserBridge not found!”
January 30, 2019 at 6:46 pm #1340PiotrKeymasterSo add it to the scene. Check readme file.
January 31, 2019 at 9:19 am #1341MeMyselfParticipantOk. I had it added into the scene but it was manually without using the prefab. Now with the prefab I have the callbacks.
Here is the result I have :
url : (null)
Error : Error Domain=WebKitErrorDomain Code=101 “(null)”I check before calling InAppBrowser.OpenURL() that the url string sent is not null and valid . I’m sure the problem is not with the url because I can have the same url loaded without problem and then having trouble with it another time.
Regards
February 5, 2019 at 8:23 am #1347MeMyselfParticipantHi Piotr,
Do you have any clue ?
I have a Scene with 3 UI pages in a Canvas (menu, levelselect and game)
It seems to occur when I change the UI to menu and then return to the game. The strange thing is there is no problem on Android.February 5, 2019 at 6:47 pm #1348PiotrKeymasterHi,
Android and iOS use completely different engines so it’s perfectly normal to see such differences.I see a lot of questions regarding this on StackOverflow like here:
https://stackoverflow.com/questions/2028379/uiwebkit-error-101Try to examine those links, maybe there’s space and the end of beginning.
February 6, 2019 at 12:31 pm #1349MeMyselfParticipantOK I found it.
it seems there is a bug (don’t know where it come from). Sometimes the url string gets a linebreak at the end (I’m sure it doesn’t come from my url because I have the same test string variable sometimes working, sometimes not). So this line in AppBrowserViewController.mm startLoadingWebView was returning null
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:_URL]];
So here’s what I did
(void)startLoadingWebView { _webView.delegate = self; if (_HTML) { [_webView loadHTMLString:_HTML baseURL:nil]; } else { NSString *webStringURL = _URL; NSArray *split = [webStringURL componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; split = [split filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"length > 0"]]; webStringURL = [split componentsJoinedByString:@""]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:webStringURL]]; [_webView loadRequest: request]; }
There must be a cleaner way, but it works.
-
AuthorPosts
- You must be logged in to reply to this topic.