Help us understand the problem. What is going on with this article?

ACAccount Twitterのuser_idを取得する

More than 5 years have passed since last update.

ACAccountからTwitterのuser_idを取得する方法です。

実装

ACAccountのカテゴリにしました。

ACAccount+Extras.h
@interface ACAccount (Extras)

- (NSString*)user_id_String;

@end
ACAccount+Extras.m
@implementation ACAccount (Extras)

- (NSString *)user_id_String
{
    NSString *idStr = [self valueForKeyPath:@"properties.user_id"];
    // 今後の仕様変更に備えて確認
    NSAssert1(idStr != nil && [idStr isKindOfClass:[NSString class]] , @"ACAccount(Extras) %@", self);
    return idStr;
}

@end

補足

Twitterでは特定のユーザーを指定する方法でuser_idscreen_nameがあります。
screen_nameはACAccountのusernameで取得出来ます。screen_name変更することも出来ます。

user_idscreen_nameが変更されても変更されることのないユーザーを識別する一意の値ですので、ユーザー管理は基本user_idでした方がよいかと思われます。

参考

http://stackoverflow.com/questions/13741438/how-to-get-the-friendslist-of-twitter-user-in-iphone

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away