Could not instantiate class named UIRefreshControl Xcode
-
03-07-2021 - |
문제
I am building a RSS feed on a tableview. When i run the app, on my iPhone could run smoothly while in ipad, it crashed and showed "Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UIRefreshControl'"
I tried to run the app on my ipad simulator, it also could run smoothly. May I know what is the problem for that?
Thanks
해결책
UIRefreshControl
only exists on iOS 6. So if your iPad is running 5.1.1, you won't be able to use UIRefreshControl
, because UIRefreshControl
did not exist in iOS 5.1.1. So when the nib decoding happens, the decoder finds "UIRefreshControl"
, it doesn't know what to do with it, and it crashes.
다른 팁
In your storyboard, click on the tableview and go to the Attribute Inspector. Under the section "TableView Controller" there is a selection window for "Refreshing" that can be set to disabled. When I built for my iPad-1, running iOS 5.1 I got an empty tableView instead of the error, 'Could not instantiate class named UIRefreshControl'. This was to be expected since I haven't populated the device with files to select, yet.