我在我的应用程序中设置了Core Spotlight.我导航到导航控制器中的特定视图控制器,该控制器根据标题显示webview网页.例如:
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray *restorableObjects))restorationHandler {
if ([[userActivity activityType] isEqualToString:CSSearchableItemActionType]) {
// This activity represents an item indexed using Core Spotlight, so restore the context related to the unique identifier.
// The unique identifier of the Core Spotlight item is set in the activity’s userInfo for the key CSSearchableItemActivityIdentifier.
NSString *uniqueIdentifier = [userActivity.userInfo objectForKey:CSSearchableItemActivityIdentifier];
NSString *valueForUID = [self valueForKey:uniqueIdentifier];
self.tabBar = (UITabBarController *)self.window.rootViewController;
self.tabBar.selectedIndex = 0;
UINavigationController *selectedNav=(UINavigationController *)self.tabBar.selectedViewController;
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
WebViewController …Run Code Online (Sandbox Code Playgroud) 我在执行函数时遇到一些麻烦,因为我不断收到有关未提供 masterKey 的相同错误:
[PFCloud callFunctionInBackground:@"changeUserModeratorStatus" withParameters:@{@"objectId": self.objId}];
Run Code Online (Sandbox Code Playgroud)
功能:
Parse.Cloud.define("changeUserModeratorStatus", function(request, response) {
Parse.Cloud.useMasterKey();
var query = new Parse.Query(Parse.User);
query.equalTo("objectId", request.params.objectId);
query.first({
success: function(anotherUser) {
anotherUser.set("ModeratorStatus", "Approved");
anotherUser.save(null, {
success: function(anotherUser) {
response.success("Successfully updated user.");
},
error: function(failedRetrieve, error) {
response.error("Could not save changes to user.");
}
});
},
error: function(error) {
response.error("Could not find user.");
}
});
});
Run Code Online (Sandbox Code Playgroud)
编辑,我已经在论坛上复制/粘贴了 Hectors 示例,检查了文档,但没有找到解决方案。无论我做什么,我都会收到错误:无法使用主密钥,尚未提供