Search code examples
iosobjective-cxcodedebuggingios6

IOS's DownloadFont feature official code doesn't work when copy paste code in new project, why?


This question is about the feature called "DownloadFont" implemented from IOS 6 which allows the application to download additional fonts that aren't available by default.

When I copy and paste all the source file content into the same files in a new project (single view template), I get an error "signal SIGABRT" from main.m and the message in the console is : "Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle". However, if I download the source code entirely as a project (as available in the above link), and run it in the same version of the same IDE (xcode6 beta2), it works perfectly.

To be more precise, what I did is copy all the content from AppDelegate.h, AppDelegate.m, ViewController.h, ViewController.m and main.m into the same files in the new project and also put the same deployment target as the sample code (6.0), but this throws the above exception.

This may not be a problem specific to DownloadFont, but I just couldn't find out why this doesn't work.


Solution

  • You are missing either the storyboard .storyboard file or view controller .xib file. Both of those files are user interface files that define how the user interface should look and behave.

    The example code isn't meant to be copied as a whole project, but rather typically only a code snippet at a time if you need it.