如何使这个parse.com云代码调用?
-
21-12-2019 - |
题
注意:
这是PARSE附近的一些想法:
https://www.parse .com /问题/ ios-while-will-swift for-parse-ready
(注意问题是多受欢迎的 - 热门话题)。希望它有助于某人
这是ios7解析云代码调用...
如何在swift中这样做?干杯
要清除...... 你可以在swift 中使用“callfunctioninbackground”,或者您必须只打电话给objc类?-(void)tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath
{
int thisRow = indexPath.row;
PFUser *delFriend = [self.theFriends objectAtIndex:thisRow];
NSLog(@"you wish to delete .. %@", [delFriend fullName] );
// note, this cloud call is happily is set and forget
// there's no return either way. life's like that sometimes
[PFCloud callFunctionInBackground:@"clientRequestFriendRemove"
withParameters:@{
@"removeThisFriendId":delFriend.objectId
}
block:^(NSString *serverResult, NSError *error)
{
if (!error)
{
NSLog(@"ok, Return (string) %@", serverResult);
}
}];
[self back]; // that simple
}
.
注意,我注意到这是一个google登陆页面,用于试图弄清楚“如何进行云代码调用”(与swift不相关)。以下是自定义云代码函数的iOS和Android
的完整,完整的示例代码,在Parse.com Universe https://stackoverflow.com/a/24010828/294884 希望它有助于某人解决方案
将Objective-C .m文件添加到您的项目中。Xcode将询问有关创建桥接头文件。说是。
删除.m文件。在桥接头文件中,添加您的Import语句:
#import <Parse/Parse.h>
.
另一个答案,它比矿井更好地演练: https://stackoverflow.com/a/24005242/353988a>
现在,您可以在Swift中调用Native Parse代码,即。:
import UIKit
import Foundation
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
Parse.setApplicationId("appid", clientKey: "clientkey")
var obj = PFObject(className:"TestObject")
obj.setObject("bar", forKey: "foo")
obj.saveInBackgroundWithBlock ({
(succeeded: Bool!, err: NSError!) -> Void in
NSLog("Hi")
})
}
}
. 其他提示
不隶属于 StackOverflow