Search code examples
objective-cxcodeios6crashxcode4.6

Unable to change Product Name in Xcode


I am developing for iOS 6 on Xcode 4.6.1

Midway through my project I decided to change name of both the project as well as the app name.

Changing the project name was pretty straightforward. As mentioned by many, I am supposed to

Double click slowly on the Xcode Project name on the top left. Change this name and a window will pop up asking you to rename the whole project, select yes and the name of your project will be changed.

But I noticed that my app target did not change.

So I tried to manually rename it. When I change my app target and run the app, it crashes.

This is the log:

*** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '***
-[NSURL initFileURLWithPath:]: nil string parameter'

I went through my code and found out that this line was causing the error:

NSString *url = [[NSBundle mainBundle]
                 pathForResource:videoName
                 ofType:@"mp4"];

The url has the value nil.

If I revert the target name back to the original, it works.

I tried a project build clean. I also tried resetting and cleaning the simulator. Nothing seems to work. Any help will be highly appreciated.

Thanks :)


Solution

  • Check your mp4 file in "Build Phases" -> "Copy Bundle Resources" list and then press "Delete..." on Window -> Organizer -> Projects -> Your project.