Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not open url in iOS #229

Closed
gunadharma opened this issue Nov 6, 2018 · 19 comments
Closed

Can not open url in iOS #229

gunadharma opened this issue Nov 6, 2018 · 19 comments

Comments

@gunadharma
Copy link

gunadharma commented Nov 6, 2018

I try to open url in Android using Flutter Webview Plugin and it works, but in iOS simulator it doesn't work. For example: I open google.com and then I search a website, I can not open the site by clicking it in google search list. Please help to resolve this..

@jordansilva
Copy link
Contributor

@gunadharma It's working here. Can you describe more how you implemented the Webview Plugin or more info about your problem?
I just added a WebviewScaffold using google url, searched for "Flutter News" and clicked on the first link (which is flutterio twitter) and it worked.

@gunadharma
Copy link
Author

Hi @jordansilva thanks for your comment, here is how i implement the plugin:
routes: { "/": (_) => new MyHomePage(title:''), "/webview": (_) => new WebviewScaffold( url: url, appBar: AppBar(), withJavascript: true, withLocalStorage: true, withZoom: true, ) },

image
For example: I open google then I search something. I can not open any links from the search result.

Is there any settings or code that I missed? Please help..

@jordansilva
Copy link
Contributor

jordansilva commented Nov 6, 2018

I'm not doing this way.
I'm creating a Stateful Widget and calling this Widget.

...

routes: {
     "/": (_) => WebView(),
}

...

class WebView extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _WebViewState();
  }
}

class _WebViewState extends State<WebView> {
  String _url = "https://www.google.com";

  @override
  Widget build(BuildContext context) {
    return new WebviewScaffold(
      url: _url,
      appBar: AppBar(),
    );
  }

}

@gunadharma
Copy link
Author

Oh I see. I will try to follow your way. Thank you very much @jordansilva

@gunadharma
Copy link
Author

@jordansilva Still can not open. I guess it is because the link is open new window/tab. not in the same window. how can we solve this?

@jordansilva
Copy link
Contributor

@gunadharma
I really don't know what are you doing...
Check the code that I've shared:
https://gist.github.com/jordansilva/42a4dd26474418fb223bbdaec5459a8b

@gunadharma
Copy link
Author

@jordansilva I am trying to click button which open url in the new window/tab but it won't open.

@jordansilva
Copy link
Contributor

@gunadharma Check this code that I shared. I guess is the same thing that you're trying.
The first screen just has a button and when you click in this button, opens the WebView, and if you can navigate in this webview.

@gunadharma
Copy link
Author

@jordansilva Okay I will check the code that you shared. Thank you very much :)

@l1Dan
Copy link

l1Dan commented Nov 8, 2018

@gunadharma Try it!
flutter clean && flutter run

@jordansilva
Copy link
Contributor

@l1Dan Can you check which flutter channel are you using? I had a problem using master, so I changed to beta channel and it worked.

@l1Dan
Copy link

l1Dan commented Nov 8, 2018

flutter clean && flutter run

@jordansilva It is working, but hava a trouble.

*** First throw call stack:
(
0 CoreFoundation 0x000000010dd8c1bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010d332735 objc_exception_throw + 48
2 CoreFoundation 0x000000010ddaaf44 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010dd90ed6 forwarding + 1446
4 CoreFoundation 0x000000010dd92da8 _CF_forwarding_prep_0 + 120
5 Runner 0x000000010b1af94c -[FlutterWebviewPlugin initWebview:] + 1692
6 Runner 0x000000010b1aec8e -[FlutterWebviewPlugin handleMethodCall:result:] + 254
7 Flutter 0x000000010b54a71b __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 115
8 Flutter <…>
Lost connection to device.

===================================
In Xcode console:
-[FlutterEngine view]: unrecognized selector sent to instance 0x600001183c20
2018-11-08 16:17:00.818887+0800 Runner[46720:2437359] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FlutterEngine view]: unrecognized selector sent to instance 0x600001183c20'

@jordansilva
Copy link
Contributor

@l1Dan Can you check flutter channel on the terminal and post the results here?

@l1Dan
Copy link

l1Dan commented Nov 8, 2018

@jordansilva OK! May be the same problem. Thank you so much!
https://github.com/flutter/flutter/issues/23962

@slightfoot
Copy link
Member

Fixed as of v0.3.0+2. Closing.

@deligence
Copy link

We are facing the same issue. The site with https are getting opened in Android as well as in iPhone. However sites with http are not getting loaded in iPhone.

@AstroDule
Copy link

@deligence Here is the solution: #94 (comment)

@folivi
Copy link

folivi commented May 31, 2019

Same here. The webiste is being loaded on Android but I get a blank white screen on ios

@charafau
Copy link
Collaborator

@folivi it should work, but you need to add keys to ios #94 (comment)

I also added this to main README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants