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
Liam Herbert
15,140 PointsAppDelegate issue
Hi After the modifications we mad in the Image Based Animation chapter the crystal ball app runs but it doesn't display any images. In the NSLog it says "There is no app delegate set. An app delegate class must be specified to use a main storyboard file." This is the code for main.m:
#import <UIKit/UIKit.h>
#import "BHAppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, nil);
NSStringFromClass([BHAppDelegate class]);
}
}
I have been trying to find what I should possibly be changing or weather I have missed a piece of syntax somewhere. Any help would be much appreciated.
Thanks, Liam
4 Answers
Stone Preston
42,016 Pointsis you app delegate named BHAppDelegate? Did you rename your project or anything?
Liam Herbert
15,140 PointsI have four:
- BHViewController.h
- BHViewController.m
- BHCrystalBall.h
- BHCrystalBall.m
As well as the Main.storyboard.
Stone Preston
42,016 PointsSo you are missing your app delegate files? That is the problem then. Are you sure they are gone? Not Anywhere in your project files? Maybe in the supporting files?
Liam Herbert
15,140 PointsOh yes they're under supporting files.
Stone Preston
42,016 Pointsand what are they named
Liam Herbert
15,140 PointsBHAppDelegate.h and BHAppDelegate.m
John W
21,558 PointsIf this is still not resolved, feel free to zip your project up, upload it somewhere, and provide us the link to it. I can take a look at it for you.
Liam Herbert
15,140 PointsThanks here is my project:
John W
21,558 Pointsthat's just the project setting file, can you upload the entire project directory zipped as one file?
Liam Herbert
15,140 PointsNo sorry. I tried to upload it to google drive but it moved the file from my mac to the google drive, and I without realizing this deleted the documents from google drive and so I have lost all my work.
Liam Herbert
15,140 PointsLiam Herbert
15,140 PointsNo I have not renamed my project.
Liam Herbert
15,140 PointsLiam Herbert
15,140 PointsWhat is the AppDelegate?
Stone Preston
42,016 PointsStone Preston
42,016 Pointsyou should have two files in your project, one named something similar to appDelegate.h and one named appDelegate.m In your case they should apparently be called BHAppDelegate.h and BHAppDelegate.m. The app delegate handles certain things like what happens when the app first finishes launching, when it enters the background, etc.