4

我有一个应用程序可以让您查看您收藏的推文,如果您不再需要它,它还可以让您从收藏夹中删除它们。

我一生都无法弄清楚为什么会出现此错误:

2013-10-13 17:33:57.306 MyApp[6233:a0b] {
    errors =     (
                {
            code = 34;
            message = "Sorry, that page does not exist";
        }
    );
}

这是我调用请求的代码:

#define TW_API_DESTROY_FAVORITE @"https://api.twitter.com/1.1/favorites/destroy.json"




- (void)deleteFavoriteWithID:(NSString *)tweetID atIndex:(int) index {


    NSURL *theURL = [NSURL URLWithString:TW_API_DESTROY_FAVORITE];

    // Get AppDelegate reference
    AppDelegate *appDelegate =[[UIApplication sharedApplication] delegate];

    NSMutableDictionary *favoriteParameters = [[NSMutableDictionary alloc] init];
    [favoriteParameters setObject:tweetID forKey:@"id"];


    // Create TWRequest, with parameters, URL & specify GET method
    SLRequest *twitterFeed = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodPOST URL:theURL parameters:favoriteParameters];

    // Specify twitter request's account to our app delegate's
    twitterFeed.account = appDelegate.userAccount;


    // Making the request

    [twitterFeed performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
        dispatch_async(dispatch_get_main_queue(), ^{

            // Check if we reached the reate limit

            if ([urlResponse statusCode] == 429) {
                NSLog(@"Rate limit reached");

                return;
            }

            // Check if there was an error

            if (error) {
                NSLog(@"Error: %@", error.localizedDescription);
                return;
            }

            // Check if there is some response data

            if (responseData) {

                NSError *jsonError = nil;
                id feedData = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:&jsonError];
                if (!jsonError) {

                    NSLog(@"%@", feedData);




                } else {

                    // Alert the user of an error


                    });

                }


            }



        });

    }];

}

无论出于何种原因,它只是不接受这一点。在应用程序的其他地方,我使用的是完全相同的代码,它工作正常,但无论出于何种原因,它都不会正常触发。

有任何想法吗?谢谢!

4

0 回答 0