Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Ben Bastow
24,657 Pointshelp with diary app!
hey! I'm on the UI for inserting Diary Entries part and on my code it won't work.. says about my main so i put a runtime error in it and it says there is something wrong with this code self.window.backgroundColor = [UIColor whiteColor]; and idk whats wrong can someone help?? I'm so confused!!
here is the lesson! http://teamtreehouse.com/library/build-a-diary-app-using-core-data/inserting-and-saving-data/ui-for-inserting-diary-entries
6 Answers
David Collins
6,643 PointsThat line of code is correct. What's the error you're getting?
Are you putting it in the application:didFinishLaunchingWithOptions method before the return?
Ben Bastow
24,657 Pointsyes :) :\" 2014-06-24 07:05:54.782 Diary[452:60b] The app delegate must implement the window property if it wants to use a main storyboard file. 2014-06-24 07:05:54.785 Diary[452:60b] -[THAppDelegate window]: unrecognized selector sent to instance 0xa1402e0 2014-06-24 07:05:54.825 Diary[452:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[THAppDelegate window]: unrecognized selector sent to instance 0xa1402e0' *** First throw call stack: ( 0 CoreFoundation 0x01b541e4 exceptionPreprocess + 180 1 libobjc.A.dylib 0x018d38e5 objc_exception_throw + 44 2 CoreFoundation 0x01bf1243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275 3 libobjc.A.dylib 0x018e5965 -[NSObject forwardInvocation:] + 68 4 CoreFoundation 0x01b442da ___forwarding_ + 458 5 CoreFoundation 0x01b440ee CF_forwarding_prep_0 + 14 6 Diary 0x0000378e -[THAppDelegate application:didFinishLaunchingWithOptions:] + 110 7 UIKit 0x0058d14f -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309 8 UIKit 0x0058daa1 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1810 9 UIKit 0x00592667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824 10 UIKit 0x005a6f92 -[UIApplication handleEvent:withNewEvent:] + 3517 11 UIKit 0x005a7555 -[UIApplication sendEvent:] + 85 12 UIKit 0x00594250 _UIApplicationHandleEvent + 683 13 GraphicsServices 0x03a07f02 _PurpleEventCallback + 776 14 GraphicsServices 0x03a07a0d PurpleEventCallback + 46 15 CoreFoundation 0x01acfca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION_ + 53 16 CoreFoundation 0x01acf9db __CFRunLoopDoSource1 + 523 17 CoreFoundation 0x01afa68c __CFRunLoopRun + 2156 18 CoreFoundation 0x01af99d3 CFRunLoopRunSpecific + 467 19 CoreFoundation 0x01af97eb CFRunLoopRunInMode + 123 20 UIKit 0x00591d9c -[UIApplication _run] + 840 21 UIKit 0x00593f9b UIApplicationMain + 1225 22 Diary 0x00003a9d main + 141 23 libdyld.dylib 0x0219b701 start + 1 24 ??? 0x00000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) "
Ben Bastow
24,657 Pointsand this is the whole of the UIColor thing
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; }
David Collins
6,643 PointsDo you have the following line in your AppDelegate.h file?
@property (strong, nonatomic) UIWindow *window;
Also, make sure you've got your storyboard selected in your Apps target settings.
Ben Bastow
24,657 PointsYes I do :)
Will Macleod
Courses Plus Student 18,780 Points2014-07-11 14:37:51.711 Diary[10565:60b] Cannot find executable for CFBundle 0x10951f330 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/CertUIFramework.axbundle> (not loaded) 2014-07-11 14:37:55.368 Diary[10565:60b] file:///Users/alexmacleod/Library/Application%20Support/iPhone%20Simulator/7.1-64/Applications/C036DF4D-68E2-4074-92AB-1067914228E1/Documents/ 2014-07-11 14:37:55.432 Diary[10565:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an entity named 'DiaryEnrty' in this model.' *** First throw call stack: ( 0 CoreFoundation 0x0000000101cb3495 exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000101a1299e objc_exception_throw + 43 2 CoreData 0x0000000100297f2a +[NSEntityDescription insertNewObjectForEntityForName:inManagedObjectContext:] + 202 3 Diary 0x0000000100001b9f -[NewEntryViewController insertDiaryEntry] + 159 4 Diary 0x0000000100001d43 -[NewEntryViewController doneWasPressed:] + 83 5 UIKit 0x00000001005c0f06 -[UIApplication sendAction:to:from:forEvent:] + 80 6 UIKit 0x00000001005c0f06 -[UIApplication sendAction:to:from:forEvent:] + 80 7 UIKit 0x00000001005c0eb4 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 17 8 UIKit 0x000000010069d880 -[UIControl _sendActionsForEvents:withEvent:] + 203 9 UIKit 0x000000010069cdc0 -[UIControl touchesEnded:withEvent:] + 530 10 UIKit 0x00000001005f7d05 -[UIWindow _sendTouchesForEvent:] + 701 11 UIKit 0x00000001005f86e4 -[UIWindow sendEvent:] + 925 12 UIKit 0x00000001005d029a -[UIApplication sendEvent:] + 211 13 UIKit 0x00000001005bdaed _UIApplicationHandleEventQueue + 9579 14 CoreFoundation 0x0000000101c42d21 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 15 CoreFoundation 0x0000000101c425f2 __CFRunLoopDoSources0 + 242 16 CoreFoundation 0x0000000101c5e46f __CFRunLoopRun + 767 17 CoreFoundation 0x0000000101c5dd83 CFRunLoopRunSpecific + 467 18 GraphicsServices 0x0000000103ce4f04 GSEventRunModal + 161 19 UIKit 0x00000001005bfe33 UIApplicationMain + 1010 20 Diary 0x0000000100001ef3 main + 115 21 libdyld.dylib 0x000000010234b5fd start + 1 22 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
what does this mean?