I am using MGTwitterEngine
SDK in my iOS
app. I am trying to check if a user is following another user with this method:
- (NSString *)isUser:(NSString *)username1 receivingUpdatesFor:(NSString *)username2
{
if (!username1 || !username2) {
return nil;
}
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
[params setObject:username1 forKey:@"user_a"];
[params setObject:username2 forKey:@"user_b"];
NSString *path = [NSString stringWithFormat:@"friendships/exists.%@", API_FORMAT];
return [self _sendRequestWithMethod:nil path:path queryParameters:params body:nil
requestType:MGTwitterUpdatesCheckRequest
responseType:MGTwitterMiscellaneous];
}
this method is always returning a string that is in this format but not the same:
CB4C097E-6740-4536-885E-BAF7D8A981FD
basically it would be better to get a bolean value, I don't have a clue about what I'm going to do with this value.
any ideas?
**EDIT the code that initialized the _engine
_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate: self];
_engine.consumerKey = kOAuthConsumerKey;
_engine.consumerSecret = kOAuthConsumerSecret;
This is an asynchronous request, you have to set your class as delegate of the MGTwitterEngine and get the result in these method, that you must implement in your class:
- (void)statusesReceived:(NSArray *)statuses forRequest:(NSString *)connectionIdentifier;
- (void)directMessagesReceived:(NSArray *)messages forRequest:(NSString *)connectionIdentifier;
- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier;
- (void)miscInfoReceived:(NSArray *)miscInfo forRequest:(NSString *)connectionIdentifier;
As you can read in the MGTwitterEngineDelegate.h:
// These delegate methods are called after all results are parsed from the connection. If // the deliveryOption is configured for MGTwitterEngineDeliveryAllResults (the default), a // collection of all results is also returned.
There you can check the result value.