注意:
以下是来自Parse的CA的一些想法:
https://www.parse.com/questions/ios-when-will-swift-for-parse-be-ready
(注意这个问题有多受欢迎 - 热门话题).希望它可以帮助某人
这是一个iOS7 Parse云代码调用...
如何在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]; // …Run Code Online (Sandbox Code Playgroud) 我和我的朋友正在开发一个应用程序,我们希望使用Parse.com作为我们的数据库,我们可以从中检索信息.我们无法确定在Parse上访问数据的最佳方法是什么.为了这个例子,我们的应用程序.(即客户端)需要存储在Parse数据库中的东西(比如一些数字) - 如果它使用Parse API直接运行查询,或者它应该向服务器端发出请求,让它从Parse中检索该数字,并且把它发回给客户?
我们知道没有确切的答案,但我们无法找到有关这一具体情况的答案.我们读了这篇文章:何时使用客户端或服务器端?,但这不完全相同的情况.
我声称我们应该尝试尽可能地从客户端和数据库中分离,并让这些查询由负责人(服务器)运行,我的朋友声称这会增加不必要的复杂性,因为使用这些工具非常自然由Parse提供,从客户端访问数据库,无需协议等.
我们会批评任何建议,
谢谢.