I'm new to Xcode, and I'm working on my first project in this environment. I have come across a real head scratcher.
My project is soon ready to be launched. So I wanted to change the product name from a silly work name to the actual name of the soon to be launched product. So I created a new Target with the real name.
When I try to compile the new target I get like 90 errors telling me that I have duplicate interface declaration. All errors occurs in cocos2d framework header files, that I use for my game.
Obviously I missed out on something creating the new target.
My first thought was that there was some kind of conflict with the old target, so I deleted it. Which wasn't the smartest thing since I now can't compare the build settings between the two targets to see what went wrong.
Is there anyone out there who can enlighten a poor sod like myself on whats wrong?
Thank you!
I think what you want is to change how the app is named in the App store and on devices. You configure the app name in iTunes Conect, and to configure how the target appears on a device, go to Target > Info > Bundle Display name and change that to what you want to appear on a device. Build and deploy, and you should see your results in the simulator.
Related
I did a major restructuring of my app, and decided the easiest way to do this, was to create a new project with a new name. After everything was working, I went in and renamed the project but now I get "A valid provisioning profile for this executable was not found."
I went into my app-info.plist and ensured that my CFBundleIdentifier is the same. I confirmed that the Project Name is the same, and that the built app is the same. I confirmed in my Build Settings that it shows my Distribution Profile.
This is the first time I've completely rewritten the app this way, is there something I've missed?
Have you tried cleaning both projects? (cmd+shift+k)
This question already has an answer here:
Build and run Fails after changing Xcode project name
(1 answer)
Closed 9 years ago.
Today I changed my Xcode project and now when I build and run the app it crashes when clicking anything in the app. If anyone could please help out I would really appreciate it, I spent so much time working on this project and had just finished it. I decided to change the name last minute and now I got myself in a pickle.
Thanks for all the help everyone but i guess I'm going to try and re work a new project all over again. :(
You need to reset the Simulator and do a Product - Clean in Xcode.
Renaming the project changes your bundle identifier. It's often recommend as a best practice to not use the default bundle identifier but to just explicitly set it com.apple.mail
After further investigation it looks like the rename is not the issue. You need to set and exception breakpoint to see what is going on.
Now run it with the debugger attached and make it crash.
Answer just for ASL
See the exception being thrown:
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: ' -[NSURL initFileURLWithPath:]: nil string parameter'
Set a breakpoint at your initFileURLWithPath method and look at it in the Xcode debugger. I bet you'll catch the path being something you weren't expecting it to be.
Original Answer:
As you've discovered, changing the name of your project can indeed be really tricky and if you don't change it properly, catastrophic things can happen.
Do you have a Time Machine backup of your project? If so, you can easily get back to last night's version of your project before you attempted to do the name change.
Then, changing the name of your app can be as simple as changing the "Bundle display name" in the info.plist file:
This is the lightweight, easy way to do it.
And yes, it doesn't change the underlying project name, but it does change the display name and for your customers, that's all that really matters.
2)
Now, to change the underlying project name, you need to have some time and patience.
I start by typing in the new name for the Xcodeproject file, like this:
Which brings up this sheet:
Then look at your target settings to make sure the old name doesn't exist anymore:
And after all that's done, you might want to change the name of your scheme (via the Xcode scheme editor), since the old name is probably still there as well.
first of all, i already searched for an answer but with no luck.. i am new in xcode!
i created a project and found out at a later moment that i needed to enable core data, so since i didnt work too much on it i decided to start new. ideleted the project folder and set up a new project with the same name. BUT this project does not run. it hit s a breakpoint and throws error after error. project is empty.. if i make the exact same thing with a project that has another name then it works fine. is there sort of a cache somewhere that is interfering with my project? how can i have my new project with the same name?
thanks
Igor
If you create project with same name with having use of core data, then your model for core data should be exactly the same. Otherwise it will not read will get crashed.
Try cleaning the targets by ⌥⇧⌘K Cmd+Shift+K.
I don't recall having this problem before I migrated to my Retina MacBook Pro, but since doing so, my projects have insisted on loading in the "old" development location. In years past, before XCode 4, we put all our products in /Development/Products. And, after migrating to the new MacBook Pro, they're going back there again. I can use 4.3 or newer and see the same problem with both, so I'm assuming it's some kind of configurable that's at work here.
Of course, the first thing I did was verify that the Preferences/Locations was set to Build Location = Unique. I confirmed this both in the GUI and by popping open the .plist to check the value of IDEBuildLocationStyle and it was set to Unique.
I tried removing my existing configuration files (everthing in ~/Library/Preferences/ named Xcode) and that succeeded in changing the behavior to putting the output in the build directory of the project itself (really not helpful in my world as I have complex multi-project workspaces). Quitting and checking the settings, they were set for IDEBuildLocationStyle=Unique.
So, I copied the working configuration from another machine I had to this one. Since it too had previously had the /Development/Products destination, but had subsequently been moved to the Unique build style, I expected that to work. It did not. It instead returned the output to /Development/Products.
Thinking it might be something with my Xcode install, I created a new user and built from the same source tree (not a duplicate, not a copy, the exact same files). In this case, the output went to the right place (unique subdirectory of the Derived Products for that user). So, I blew away the ~/Preferences/*Xcode* again and copied in the preferences from the new user. Unfortunately, this took us back to the same behavior that the uninitialized configuration had, which is to say building in the build directory of the project itself.
I restored to my backup configuration files, and now I'm back to working at /Development/Products, but this isn't a good long term solution.
When checking the script output for a test script, I can clearly see that somebody is setting SYMROOT to /Development/Products in the case of the older config, and build in the case of the default configuration file.
Clearly there's something here on this system that's influencing the configuration, but I cannot figure out what it is. Any assistance would be highly appreciated!
Also - When I try to use option-Clean to enable Clean Build Folder, it is never enabled, which makes a certain kind of sense, but I thought it might be another data point.
I tried the solution in Strange behavior of Xcode Build Products Path under Build Locations and that had the same result as deleting the preferences: build products as children of the project directory.
Has anyone else seen such a problem? Have you found a solution?
Well, after a very long time of suffering through this on my laptop, I was finally able to track down the problem.
Inside of:
project.xcworkspace/xcuserdata/<user>.xcuserdatad/
there is a WorkspaceSettings.xcsettings file.
It contained a key BuildLocationStyle, which was set to UseTargetSettings.
Deleting the file and thus resetting this value allowed me to get both the Clean Build Folder... working and to get my project building correctly.
Hopefully this will help somebody else.
I am currently working on a project which runs just fine in both the simulator and on device except for one particular method which does not update on the device or in the simulator. It seams that I can put whatever I like in it and it just runs an old version. If I change other methods in the same file they build and run with the changes. Any ideas why this is happening or what I could do to solve it?
One suggestion I heard was to start a new project and copy my code in. I would like to avoid that if possible but it looks like I might have to.
Sometimes you need to do a clean build because Xcode does not always notice dependency changes (e.g. changes to source files).
Some people do not configure their dependencies (e.g. static/dynamic libraries) correctly. If you are using the auto-detect-dependency feature, it still has some bugs, so you may need to configure this explicitly.
FWIW, starting a new project has never been necessary for me...