0

我一生无法弄清楚如何建立连接以从 ios Facebook sdk 中的帖子中删除我的喜欢。这是我喜欢连接的代码。我如何删除喜欢的?我无法建立 startForDelete 连接。

// 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];
4

1 回答 1

1

您正在发出 POST 请求,您已发出 DELETE 请求。代替:

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"];
于 2013-04-23T18:40:03.927 回答