0
我試圖從twitter中製作UIButton
特定tweet
的收藏夾計數的標題。我可以在功能上獲得該數字,並且我已成功通過Twitter授權。這裏是我在嘗試設置標題:UIButton獲取錯誤設置標題
//Set number of Favorites for Tweet
NSObject *favoritesCount = [[tweet objectForKey:@"user"]objectForKey:@"favourites_count"];
UIButton *favoritesButton = (UIButton *)[cell viewWithTag:204];
favoritesButton.titleLabel.text = favoritesCount;
當我運行此我得到的錯誤在favoritesButton.titleLabel.text = favoritesCount;
這裏是我得到的錯誤:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0x8d3a3a0'
如果您將NSObject * favouritesCount更改爲NSObject *收藏夾,會發生什麼情況? – GuybrushThreepwood
爲什麼你只用NSObject來計數? –
確定這意味着'[cell viewWithTag:204];'傳遞了錯誤的對象。你如何將這個uibutton添加到cellview?它仍然有效嗎?你不想使用屬性而不是視圖標籤? –