Курс 2 Урок 43 Задание на рейтинг


#1

Собственно, решил попробовать сделать данное задание.
Как мне кажется, всё прописано верно и логично, но, вероятно, нет.
При попытке выбрать ресторан, приложение падает с ошибкой

[details=Ошибка]2017-10-15 18:37:36.615628+0300 Course2AppEatiries[2974:185806] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘An instance of NSFetchedResultsController requires a fetch request with sort descriptors’
*** First throw call stack:
(
0 CoreFoundation 0x0000000113add1cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010d06ff41 objc_exception_throw + 48
2 CoreData 0x000000010d7c7998 -[NSFetchedResultsController initWithFetchRequest:managedObjectContext:sectionNameKeyPath:cacheName:] + 2056
3 Course2AppEatiries 0x000000010c282f5b _T0So26NSFetchedResultsControllerCAByxGSo14NSFetchRequestCyxG05fetchE0_So22NSManagedObjectContextC07managedhI0SSSg18sectionNameKeyPathAK05cacheL0tcfcTO + 395
4 Course2AppEatiries 0x000000010c27d8ad _T0So26NSFetchedResultsControllerCAByxGSo14NSFetchRequestCyxG05fetchE0_So22NSManagedObjectContextC07managedhI0SSSg18sectionNameKeyPathAK05cacheL0tcfC + 237
5 Course2AppEatiries 0x000000010c286807 _T018Course2AppEatiries26EateryDetailViewControllerC11viewDidLoadyyF + 1063
6 Course2AppEatiries 0x000000010c287fc4 _T018Course2AppEatiries26EateryDetailViewControllerC11viewDidLoadyyFTo + 36
7 UIKit 0x000000010e4ddd51 -[UIViewController loadViewIfRequired] + 1235
8 UIKit 0x000000010e4de19e -[UIViewController view] + 27
9 UIKit 0x000000010e51013b -[UINavigationController _startCustomTransition:] + 954
10 UIKit 0x000000010e526894 -[UINavigationController _startDeferredTransitionIfNeeded:] + 686
11 UIKit 0x000000010e527b90 -[UINavigationController __viewWillLayoutSubviews] + 115
12 UIKit 0x000000010e77e2ae -[UILayoutContainerView layoutSubviews] + 231
13 UIKit 0x000000010e40e551 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1331
14 QuartzCore 0x000000011521d4ba -[CALayer layoutSublayers] + 153
15 QuartzCore 0x00000001152215a9 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 401
16 QuartzCore 0x00000001151aa1cd _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 365
17 QuartzCore 0x00000001151d5ae4 _ZN2CA11Transaction6commitEv + 500
18 UIKit 0x000000010e36a687 _afterCACommitHandler + 272
19 CoreFoundation 0x0000000113a7fdb7 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
20 CoreFoundation 0x0000000113a7fd0e __CFRunLoopDoObservers + 430
21 CoreFoundation 0x0000000113a64324 __CFRunLoopRun + 1572
22 CoreFoundation 0x0000000113a63a89 CFRunLoopRunSpecific + 409
23 GraphicsServices 0x0000000114fa49c6 GSEventRunModal + 62
24 UIKit 0x000000010e33fd30 UIApplicationMain + 159
25 Course2AppEatiries 0x000000010c284a87 main + 55
26 libdyld.dylib 0x00000001162d5d81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) [/details]

Вот Проект

Буду рад помощи!
Заранее Спасибо!


#2

Добавьте SortDescriptor:


#3

Спасибо за ответ.
А если мне не нужна сортировка? Ведь по сути, я просто достаю значение рейтинга из памяти.