[英]MGTwitterEngine check if following a user
我在iOS
應用中使用MGTwitterEngine
SDK。 我正在嘗試檢查一個用戶是否正在使用此方法關注另一個用戶:
- (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];
}
此方法始終返回此格式但不相同的字符串:
CB4C097E-6740-4536-885E-BAF7D8A981FD
基本上,獲得布爾值會更好,我不知道如何使用該值。
有任何想法嗎?
**編輯初始化_engine的代碼
_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate: self];
_engine.consumerKey = kOAuthConsumerKey;
_engine.consumerSecret = kOAuthConsumerSecret;
這是一個異步請求,您必須將您的類設置為MGTwitterEngine的委托,並在必須在您的類中實現的以下方法中獲取結果:
- (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;
您可以在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.
在那里您可以檢查結果值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.