I followed this tutorial closely, with the only exceptions being that I didnāt prefix my files with RWT, and I am using XCode 7.2. Iāve looked over and over the example code and keep getting an error at this line:
masterController.bugs = bugs;
The stack trace reads as follows:
2016-03-09 08:29:01.206 ScaryBugs[13157:562293] -[UINavigationController setBugs:]: unrecognized selector sent to instance 0x7f80f402b000 2016-03-09 08:29:01.208 ScaryBugs[13157:562293] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationController setBugs:]: unrecognized selector sent to instance 0x7f80f402b000' *** First throw call stack: ( 0 CoreFoundation 0x0000000110332e65 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010fda9deb objc_exception_throw + 48 2 CoreFoundation 0x000000011033b48d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x000000011028890a ___forwarding___ + 970 4 CoreFoundation 0x00000001102884b8 _CF_forwarding_prep_0 + 120 5 ScaryBugs 0x000000010f8a2ea2 -[AppDelegate application:didFinishLaunchingWithOptions:] + 1186 6 UIKit 0x00000001106d71f1 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272 7 UIKit 0x00000001106d8397 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415 8 UIKit 0x00000001106decc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760 9 UIKit 0x00000001106dbe7b -[UIApplication workspaceDidEndTransaction:] + 188 10 FrontBoardServices 0x00000001130e0754 -[FBSSerialQueue _performNext] + 192 11 FrontBoardServices 0x00000001130e0ac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45 12 CoreFoundation 0x000000011025ea31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 13 CoreFoundation 0x000000011025495c __CFRunLoopDoSources0 + 556 14 CoreFoundation 0x0000000110253e13 __CFRunLoopRun + 867 15 CoreFoundation 0x0000000110253828 CFRunLoopRunSpecific + 488 16 UIKit 0x00000001106db7cd -[UIApplication _run] + 402 17 UIKit 0x00000001106e0610 UIApplicationMain + 171 18 ScaryBugs 0x000000010f8a455f main + 111 19 libdyld.dylib 0x0000000112a8692d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
Any ideas on why this happened and how I can fix it?
try this:
UINavigationController *nav = [splitViewController.viewControllers firstObject];
RWTMasterViewController *masterController = [nav.viewControllers objectAtIndex:0];
masterController.bugs = bugs;
the problem may be that you didnāt get the right view. check your Main.storyboard. in the latest version, the structure of views is quite different with what is shown in this article.
Hello, was wondering if you guys were able to fix this issue? Iām getting an error too. But now when I tried to remove
UINavigationController *navController = (UINavigationController *) self.window.rootViewController;
with
UINavigationController *nav = [splitViewController.viewControllers firstObject];
now Iām getting an error
"Unknown receiver āsplitViewControllerā; did you mean āUISplitViewControllerā?
piet
November 22, 2016, 10:50am
5
Hello,
Iām getting a different kind of error message when creating the ScaryBugDoc.h file:
//
// ScaryBugDoc.h
// ScaryBugs
//
// Created by Pierre Binon on 2016-11-21.
// Copyright Ā© 2016 Pierre Binon. All rights reserved.
//
#import <Foundation/Foundation.h>
@class ScaryBugData;
@interface ScaryBugDoc : NSObject
@property (strong) ScaryBugData *data;
@property (strong) UIImage *thumbImage;
@property (strong) UIImage *fullImage;
(id) initWithTitle: (NSString *) title rating: (float) rating thumbImage: (UIImage *) thumbImage fullImage: (UIImage *) fullImage;
@end
On both lines with the @property for thumbImage and fullImage, it says "Unknown type name āUIImageāā¦ Iām using Xcode 8
Any idea as to why itās doing that?
Thanks for your help!
Pierre
The reason why it says āUnkown type name āUIImageāā is because you need to import UIKit in the scarybugdata.h file
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
Hello,
Managed to fix the issue ,below is the change ā
UINavigationController *navController = (UINavigationController *) self.window.rootViewController;
with
UINavigationController navController = [[(UISplitViewController )self.window.rootViewController viewControllers] firstObject];
This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]