0

以下の私のコードを見てください:

NSError *jsonParsingError;
NSDictionary *jsonResults = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:&jsonParsingError];
NSArray *trends = jsonResults[@"trends"]; //error on this line

「認識されないセレクターがインスタンスに送信されました」というエラーが発生します。

私が使用する URL は次のとおりです。https://api.twitter.com/1.1/trends/place.json?id=1

jsonResults 値を見てください。

jsonResults 値を見てください

TwitterSearch (サンプル アプリケーション) の結果と比較すると、次のようになります。

Twitter検索結果との比較

jsonResults 変数のログに記録された値は次のとおりです。

2013-08-26 11:05:44.489 TwitterTrends[48410:490b] JSON: (
        {
        "as_of" = "2013-08-26T03:04:24Z";
        "created_at" = "2013-08-26T02:51:26Z";
        locations =         (
                        {
                name = Worldwide;
                woeid = 1;
            }
        );
        trends =         (
                        {
                events = "<null>";
                name = "#chupaedu";
                "promoted_content" = "<null>";
                query = "%23chupaedu";
                url = "http://twitter.com/search?q=%23chupaedu";
            },
                        {
                events = "<null>";
                name = "#VMA2013NAMTV";
                "promoted_content" = "<null>";
                query = "%23VMA2013NAMTV";
                url = "http://twitter.com/search?q=%23VMA2013NAMTV";
            },
                        {
                events = "<null>";
                name = "#YoConfiesoQue";
                "promoted_content" = "<null>";
                query = "%23YoConfiesoQue";
                url = "http://twitter.com/search?q=%23YoConfiesoQue";
            },
                        {
                events = "<null>";
                name = "#MiObsesionPor";
                "promoted_content" = "<null>";
                query = "%23MiObsesionPor";
                url = "http://twitter.com/search?q=%23MiObsesionPor";
            },
                        {
                events = "<null>";
                name = "#LasMejoresPeliculasQueViFueron";
                "promoted_content" = "<null>";
                query = "%23LasMejoresPeliculasQueViFueron";
                url = "http://twitter.com/search?q=%23LasMejoresPeliculasQueViFueron";
            },
                        {
                events = "<null>";
                name = "Emile Sande";
                "promoted_content" = "<null>";
                query = "%22Emile+Sande%22";
                url = "http://twitter.com/search?q=%22Emile+Sande%22";
            },
                        {
                events = "<null>";
                name = "Daniel Furlan";
                "promoted_content" = "<null>";
                query = "%22Daniel+Furlan%22";
                url = "http://twitter.com/search?q=%22Daniel+Furlan%22";
            },
                        {
                events = "<null>";
                name = JHud;
                "promoted_content" = "<null>";
                query = JHud;
                url = "http://twitter.com/search?q=JHud";
            },
                        {
                events = "<null>";
                name = "Omg Adam Lambert";
                "promoted_content" = "<null>";
                query = "%22Omg+Adam+Lambert%22";
                url = "http://twitter.com/search?q=%22Omg+Adam+Lambert%22";
            },
                        {
                events = "<null>";
                name = "Macklemore & Ryan Lewis";
                "promoted_content" = "<null>";
                query = "%22Macklemore+%26+Ryan+Lewis%22";
                url = "http://twitter.com/search?q=%22Macklemore+%26+Ryan+Lewis%22";
            }
        );
    }
)
4

1 に答える 1