我在Flutter中开发应用程序时遇到了以下问题:当我从计算机上安装应用程序在真实的设备上,rate-my-app运行良好(也在模拟器上是好的)。将弹出包含开始的窗口。然而,当我从TestFlight安装相同的应用程序时,rate-my-app功能已经失效。什么也没发生。未弹出启动窗口。非常兴奋。会有什么问题呢?
以下是费率类:
class RateAppInitWidget extends StatefulWidget {
final Widget Function(RateMyApp) builder;
const RateAppInitWidget({Key key, this.builder}) : super(key: key);
@override
_RateAppInitWidgetState createState() => _RateAppInitWidgetState();
}
class _RateAppInitWidgetState extends State<RateAppInitWidget> {
RateMyApp rateMyApp;
/// Rate App-------------------------
List<Widget> actionBuilder(BuildContext context, double stars) {
return stars == null
? [buildCancelButton()]
: [buildOkButton(stars), buildCancelButton()];
}
Widget buildOkButton(double starNumber) {
final event = RateMyAppEventType.rateButtonPressed;
rateMyApp.callEvent(event);
if (starNumber >= 4.0) {
return RateMyAppRateButton(
rateMyApp,
text: 'Ok',
);
} else {
Utils.openEmail(
toEmail: 'sttaaat@gmail.com',
subject: 'App',
body: 'Hi developers!');
Navigator.of(context).pop();
return Container();
}
}
Widget buildCancelButton() {
return RateMyAppNoButton(
rateMyApp,
text: 'Cancel',
);
}
/// Rate App-------------------------
@override
Widget build(BuildContext context) => RateMyAppBuilder(
rateMyApp: RateMyApp(
googlePlayIdentifier: packageNameAndroid,
appStoreIdentifier: packageNameIOS,
minDays: 5,
minLaunches: 5,
remindDays: 2,
remindLaunches: 5
),
onInitialized: (context, rateMyApp) {
setState(() => this.rateMyApp = rateMyApp);
if (rateMyApp.shouldOpenDialog) {
rateMyApp.showStarRateDialog(
context,
title: 'What do you think?',
message: 'Please rate our App',
starRatingOptions: StarRatingOptions(initialRating: 5),
actionsBuilder: actionBuilder);
}
},
builder: (context) => rateMyApp == null
? Center(child: CircularProgressIndicator())
: widget.builder(rateMyApp)
);
}
字符串
//这是要呼叫的按钮:
Widget build(BuildContext context) {
return Column(
children: [
Divider(color: Colors.black38, height: 5.0),
ListTile(
leading: Icon(Icons.rate_review),
title: Text('Rate App'),
onTap: () => widget.rateMyApp.showStarRateDialog(
context,
title: 'What do you think?',
message: 'Please rate our App',
starRatingOptions: StarRatingOptions(initialRating: 5),
actionsBuilder: actionBuilder),
),
型
2条答案
按热度按时间ohfgkhjo1#
原因是rate_my_app调用底层的原生iOS方法
requestReview(in:)
--但如果应用是使用TestFlight安装的,则此方法将被禁用。https://developer.apple.com/documentation/storekit/skstorereviewcontroller/3566727-requestreview
When your app calls this method while it’s in development mode, StoreKit always displays the rating and review request view, so you can test the user interface and experience. However, this method has no effect in apps that you distribute for beta testing using TestFlight.
个uajslkp62#
记下以下步骤,以避免realize build中的bug:
->忽略警告
-> Follow widget tree属性
->忽略不正确使用父数据警告
->使用扩展时忽略警告