Ios Http删除?删除一个类似的?
我一辈子都不知道如何建立连接,从ios Facebook sdk中的帖子中删除我喜欢的内容。这是我喜欢的连接代码。如何删除类似的内容?我无法建立startForDelete连接Ios Http删除?删除一个类似的?,ios,xcode,facebook,http,http-delete,Ios,Xcode,Facebook,Http,Http Delete,我一辈子都不知道如何建立连接,从ios Facebook sdk中的帖子中删除我喜欢的内容。这是我喜欢的连接代码。如何删除类似的内容?我无法建立startForDelete连接 // create the connection object FBRequestConnection *newConnection = [[FBRequestConnection alloc] init]; // create a handler block to handle the
// create the connection object
FBRequestConnection *newConnection = [[FBRequestConnection alloc] init];
// create a handler block to handle the results of the request for fbid's profile
FBRequestHandler handler =
^(FBRequestConnection *connection, id result, NSError *error){
// output the results of the request
[self likeCompleted:connection thisObject:thisObject thisIndexPath:thisPath result:result error:error];
};
// vars
NSString *postString = [NSString stringWithFormat:@"%@/likes", thisObject.itemId];
FBGraphObject *graphObject = [[FBGraphObject alloc] init];
// create request
FBRequest *request = [[FBRequest alloc] initForPostWithSession:FBSession.activeSession graphPath:[NSString stringWithFormat:@"%@", postString] graphObject:graphObject];
// add the request
[newConnection addRequest:request completionHandler:handler];
// add to open conection
[openFbConnections addObject:thisObject.userId];
// if there's an outstanding connection, just cancel
[requestConnection cancel];
// keep track of our connection, and start it
requestConnection = newConnection;
[newConnection start];
您正在发出POST请求,您已发出删除请求。替换:
FBRequest *request = [[FBRequest alloc] initForPostWithSession:FBSession.activeSession graphPath:[NSString stringWithFormat:@"%@", postString] graphObject:graphObject];
与:
FBRequest *request = [[FBRequest alloc] initWithSession:FBSession.activeSession graphPath:postString parameters:nil HTTPMethod:@"DELETE"];