नए आईओएस 5 एपीआई का उपयोग करके ट्विटर पर किसी का अनुसरण "करने" की कोशिश कर रहा है, 406 रिटर्न त्रुटि प्राप्त कर रहा है। क्यूं कर?नए आईओएस 5 एपीआई का उपयोग करके ट्विटर पर किसी को "फ़ॉलो" करने का प्रयास कर, 406 रिटर्न त्रुटि प्राप्त हो रही है। क्यूं कर?
क्या मेरा कोड सही है? यह पता लगाने की आवश्यकता है कि यह क्यों काम नहीं कर रहा है ....
- (void)followOnTwitter:(id)sender
{
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[accountStore requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error) {
if(granted) {
// Get the list of Twitter accounts.
NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];
// For the sake of brevity, we'll assume there is only one Twitter account present.
// You would ideally ask the user which account they want to tweet from, if there is more than one Twitter account present.
if ([accountsArray count] > 0) {
// Grab the initial Twitter account to tweet from.
ACAccount *twitterAccount = [accountsArray objectAtIndex:0];
NSMutableDictionary *tempDict = [[NSMutableDictionary alloc] init];
[tempDict setValue:@"sortitapps" forKey:@"screen_name"];
[tempDict setValue:@"true" forKey:@"follow"];
TWRequest *postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"http://api.twitter.com/1/friendships/create.format"]
parameters:tempDict
requestMethod:TWRequestMethodPOST];
[postRequest setAccount:twitterAccount];
[postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
NSString *output = [NSString stringWithFormat:@"HTTP response status: %i", [urlResponse statusCode]];
NSLog(@"%@", output);
}];
}
}
}];
}
सभी कोड सही दिखते हैं। क्या पैरामीटर गलत हैं? क्या यूआरएल सही है? यहां कुछ दिशा की आवश्यकता है ....
के रूप में समझाने के लिए नीचे का उपयोग कर सकते, त्रुटि गलत URL जो 'होना चाहिए' 'http से आता है। '/' http: // api.twitter.com/1/दोस्ती/create.format''' – Martin
के बजाय कॉम/1/दोस्ती/create.json''' जैसा कि नीचे बताया गया है, यह https नहीं है http इसलिए उपर्युक्त टिप्पणी गलत है –