Closed Eddiegooo closed 3 years ago
@Eddiegooo
Please provide flutter doctor -v
and a complete reproducible code sample that we can use to replicate the issue you are facing.
Thanks.
@Eddiegooo Please provide
flutter doctor -v
and a complete reproducible code sample that we can use to replicate the issue you are facing. Thanks.
[✓] Flutter (Channel stable, 1.22.4, on Mac OS X 10.15.4 19E287 darwin-x64, locale zh-Hans-CN) • Flutter version 1.22.4 at /Users/**/Fan/Work/FlutterSoure/flutter • Framework revision 1aafb3a8b9 (6 weeks ago), 2020-11-13 09:59:28 -0800 • Engine revision 2c956a31c0 • Dart version 2.10.4 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/**/Library/Android/sdk • Platform android-29, build-tools 29.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 11.4.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.4.1, Build version 11E503a ! CocoaPods 1.7.5 out of date (1.8.0 is recommended). CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To upgrade: sudo gem install cocoapods
[✓] Android Studio (version 4.0) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin installed • Dart plugin version 193.7547 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] Connected device (1 available) • iPhone 11 Pro Max (mobile) • B6406776-E8D2-4D10-962C-5526CF517717 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)
@Eddiegooo We will also need a minimal complete reproducible code sample as requested earlier, that we can copy paste and run to see the issue you are seeing. Thanks.
@Eddiegooo We will also need a minimal complete reproducible code sample as requested earlier, that we can copy paste and run to see the issue you are seeing. Thanks.
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
void _incrementCounter() async {
String specialString =
"https://baijiahao.baidu.com/s?id=1686309037418242167&wfr=spider&for=pc随便加点中文";
if (await canLaunch(specialString)) {
await launch(specialString);
} else {
throw 'can not open $specialString';
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[Text("Test url launcher")],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
i try to fix it! fix url == nil
@Eddiegooo Tried your code sample on latest master, but didn't see the crash, although the url provided returned with:
Do you see the crash by running the code you provided ? or we need to use any other url to replicate the crash ?
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
iOS system, use OC language, When using "url_launcher" plugin, if the urlString is illegal or Unusual, so [NSURL URLWithString:urlString] = nil, calling the canOpenURL method will crash.
eg: urlString = "https://baijiahao.baidu.com/s?id=1686309037418242167&wfr=spider&for=pc随便加点中文", NSURL *url = [NSURL URLWithString:urlString]; the url == nil, calling the "canOpenURL" method crash.