Renaming an application?

Discussion in 'iOS Programming' started by Vengeance2001, Jul 22, 2008.

  1. Vengeance2001 macrumors newbie

    Jul 22, 2008
    I am developing my first application and I used one of Apple's sample programs as my starting point. I've gotten pretty far with it but when I went to rename it, it would crash as soon as I also renamed the AppDelegate class that was in the example. If I renamed it back to the original name, it would run again so I know that was the specific issue.

    When I run it (with the new name) in the debugger, it crashes before it ever even gets to main() so I really have no idea what the issue is or where it is still retaining the old name, and thus trying to load the old class name unsuccessfully.

    Any help would be appreciated.
  2. Enuratique macrumors 6502

    Apr 28, 2008
    OK, so renaming classes in the manner you are trying to do is (in my humble opinion) a lot more hassle than what it's worth. There are just too many references (both in Interface Builder, .h files, and the like) that it will take forever tracking down ALL the places you need to rename - it's not just one place. I understand what you're trying to do, but those examples are intended to be used as a "here's how we [said in context of Apple's developer team] would go about this specific use case". It's not intended to be something you can rename and then gut to fit your needs. The idea is that you would create your program from scratch but use the core functionality (the meat of the included methods) as a template for writing your core functionality. What I mean is you would create your own project from scratch, build your own views and what not in the same structure that Apple did, but using your own class names.

    Unfortunately, it's late and I've had a bit to drink, otherwise I'd be more descriptive, but there's a new blogger whoring out his site on these forums; I checked it out and the articles are decent enough that you might learn a thing or two from starting a project from scratch with its content.
  3. ayasin macrumors 6502

    Jun 26, 2008
    First use refactor, don't just rename the file or class. Right click on the name and select of the options is rename. Next go to interface builder and make sure that delegates are correctly pointed to the new name. I agree with the previous poster that you should start your own project for your own work but there are times when you need to do this in your own projects and it's useful to know how.
  4. Vengeance2001 thread starter macrumors newbie

    Jul 22, 2008
    Ok thanks for both of the tips. It's a little late to start over at this point though. :) I tried the Refactor command on the old name and it didn't find any occurrences of the old name other than the one I had just made to right-click on--so it didn't fix the problem.

    Let me try a different approach now. If I have an application which is crashing before reaching the first line of the autogenerated main() function, how can I diagnose and remedy the problem?


Share This Page