2013-08-26 4 views
0

"인식 할 수없는 선택기 인스턴스로 전송".트위터 동향 API 1.1 오류가 아래에있는 내 코드를 살펴

내가 사용하는 URL은 다음과 같습니다 https://api.twitter.com/1.1/trends/place.json?id=1

이 jsonResults 값을 살펴보십시오 :

Compared to the TwitterSearch results

다음 TwitterSearch (샘플 응용 프로그램) 결과에 비해

Take a look at the jsonResults value

여기에 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"; 
      } 
     ); 
    } 
) 
+0

"인스턴스에 보낸 인식 할 수없는 선택기 오류가 발생했습니다." - 좋아, ** 인스턴스, 클래스 및 선택기가 관련되어 있습니까? –

+0

오 죄송합니다, 질문을 편집하겠습니다 –

+1

오류가 아주 분명합니다. 리턴 된 JSON을 보거나'NSLog()'의 출력을 simpky로 보아라. JSON의 루트 값은 사전이 아니라 배열입니다. –

답변

1

H2CO3로 나타낸 바와 같이 배열 사전을 반환하지 않았다. 내 코드를 다음으로 수정했습니다.

NSArray * jsonResults = [NSJSONSerialization JSONObjectWithData : responseData 옵션 : 0 오류 : & jsonParsingError];