iOS应用程序从InRestrictDeContent extension启动
我需要在应用程序中通过Siri实现乘车预订功能。我成功地向应用程序添加了扩展,现在我能够与Siri通信,但我没有成功地在应用程序中启动应用程序以继续进行骑乘预订过程。 所以问题来了,从InRestrictDeContent extension启动应用程序应该做些什么 提前谢谢 RideIntentHandler.miOS应用程序从InRestrictDeContent extension启动,ios,objective-c,siri,sirikit,Ios,Objective C,Siri,Sirikit,我需要在应用程序中通过Siri实现乘车预订功能。我成功地向应用程序添加了扩展,现在我能够与Siri通信,但我没有成功地在应用程序中启动应用程序以继续进行骑乘预订过程。 所以问题来了,从InRestrictDeContent extension启动应用程序应该做些什么 提前谢谢 RideIntentHandler.m - (void)confirmRequestRide:(INRequestRideIntent *)intent completion:(void (^)(INRequestRide
- (void)confirmRequestRide:(INRequestRideIntent *)intent completion:(void (^)(INRequestRideIntentResponse * _Nonnull))completion {
INRideOption *rideOption = [[INRideOption alloc] initWithName:@"blah" estimatedPickupDate:[NSDate dateWithTimeIntervalSinceNow:300]];
rideOption.userActivityForBookingInApplication = [[NSUserActivity alloc] initWithActivityType:@"blahblah"];
INRideStatus *rideStatus = [[INRideStatus alloc] init];
rideStatus.rideOption = rideOption;
rideStatus.estimatedPickupDate = [NSDate dateWithTimeIntervalSinceNow:300];
rideStatus.rideIdentifier = [NSUUID UUID].UUIDString;
INRequestRideIntentResponse *response = [[INRequestRideIntentResponse alloc] initWithCode:INRequestRideIntentResponseCodeSuccess userActivity:nil];
response.rideStatus = rideStatus;
completion(response);
}
- (void)application:(UIApplication *)application handleIntent:(INIntent *)intent completionHandler:(void (^)(INIntentResponse * _Nonnull))completionHandler {
[Utils showCommonAlertWithMessage:@"blah"];
if ([intent isKindOfClass:[INRequestRideIntent class]]) {
[Utils showCommonAlertWithMessage:@"blah"];
}
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler {
[Utils showCommonAlertWithMessage:@"blah"];
if ([userActivity.interaction.intent isKindOfClass:[INRequestRideIntent class]]) {
NSLog(@"%@", userActivity.userInfo);
[Utils showCommonAlertWithMessage:@"blah"];
}
return YES;
}
- (void)application:(UIApplication *)application didFailToContinueUserActivityWithType:(NSString *)userActivityType error:(NSError *)error {
[Utils showCommonAlertWithMessage:@"blah"];
}
AppDelegate.m
- (void)confirmRequestRide:(INRequestRideIntent *)intent completion:(void (^)(INRequestRideIntentResponse * _Nonnull))completion {
INRideOption *rideOption = [[INRideOption alloc] initWithName:@"blah" estimatedPickupDate:[NSDate dateWithTimeIntervalSinceNow:300]];
rideOption.userActivityForBookingInApplication = [[NSUserActivity alloc] initWithActivityType:@"blahblah"];
INRideStatus *rideStatus = [[INRideStatus alloc] init];
rideStatus.rideOption = rideOption;
rideStatus.estimatedPickupDate = [NSDate dateWithTimeIntervalSinceNow:300];
rideStatus.rideIdentifier = [NSUUID UUID].UUIDString;
INRequestRideIntentResponse *response = [[INRequestRideIntentResponse alloc] initWithCode:INRequestRideIntentResponseCodeSuccess userActivity:nil];
response.rideStatus = rideStatus;
completion(response);
}
- (void)application:(UIApplication *)application handleIntent:(INIntent *)intent completionHandler:(void (^)(INIntentResponse * _Nonnull))completionHandler {
[Utils showCommonAlertWithMessage:@"blah"];
if ([intent isKindOfClass:[INRequestRideIntent class]]) {
[Utils showCommonAlertWithMessage:@"blah"];
}
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler {
[Utils showCommonAlertWithMessage:@"blah"];
if ([userActivity.interaction.intent isKindOfClass:[INRequestRideIntent class]]) {
NSLog(@"%@", userActivity.userInfo);
[Utils showCommonAlertWithMessage:@"blah"];
}
return YES;
}
- (void)application:(UIApplication *)application didFailToContinueUserActivityWithType:(NSString *)userActivityType error:(NSError *)error {
[Utils showCommonAlertWithMessage:@"blah"];
}