我正在使用url_launcher依赖项,在我的图标上拥有一个拨号功能;然而,这在Android上有效,但不在iOS上有效?
调用launcher方法应该是:
_launchcaller() async
{
const url = '719-282-2224';
if (await canLaunch(url))
{
await launch(url);
}
else{
throw 'Could not launch $url';
}
}
然后,我在onTap监听器上调用该方法,代码如下:
new GestureDetector(
onTap: _launchcaller,
child: new Icon(Icons.phone, color: Colors.blue, size: 50.0,),
),
异常输出:
[VERBOSE-2:dart_error.cc(16)] Unhandled exception:
Could not launch tel:719-282-2224
#0 angryScreenState._launchcaller (file:///Users/ielbouyahyaouy/AndroidStudioProjects/app_firebase/flutter_app_books/lib/angryScreen.dart:103:7)
<asynchronous suspension>
#1 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
#2 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
#3 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7)
#4 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
#5 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
#6 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
#7 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
#8 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (packag<…>