我遵循Using JSON to Build a Twitter Client教程,但我試圖從我自己的Rails API而不是Twitter獲取數據。正在生成我JSON如下:解析Titanium中的Rails JSON?
[ { "name":"Some Text", "created_at":"2011-05-15T15:33:37Z", "id":1, "image": { "url":"/uploads/image/1/2611c0.jpg", "thumb": { "url":"/uploads/image/1/thumb_2611c0.jpg" } }, "updated_at":"2011-05-15T15:33:37Z" }, { "name":"Some More Text", "created_at":"2011-05-15T15:43:37Z", "id":2, "image": { "url":"/uploads/image/2/2756c0.jpg", "thumb": { "url":"/uploads/image/2/thumb_2756c0.jpg" } }, "updated_at":"2011-05-15T15:43:37Z" } ]
當我試圖通過它來解析這個數組,然後循環,我得到這個看似無窮無盡的控制檯消息:
[WARN] [object TiUIView] has an auto height value of 0, meaning this view may not be visible.
據我所知,這手段由於解析問題,數組是空的。爲了測試,我在視圖中創建了一個簡單的標籤,並傳遞了原始的JSON對象。它顯示正確,所以Rails正在做它的工作。感謝您的任何建議!
編輯 Ti作爲請求的代碼:http://pastie.org/1928676
你能分享一下鈦碼嗎? – bh88 2011-05-19 20:58:26
在給視圖保持不變的高度後,你嘗試過了嗎? – 2011-05-20 04:57:37