Duplicating a project and changing its name - ios

I was creating a new project that is a copy of another project. The thing is that when I want to rename the project, some connection problems appear when I want to execute my app. Can someone tell me a good way to replace all the names of the old project? The classe names are the same in the new one, so I don't have to change them.
Thanks!

I have done this recently and it was a straightforward process.
I suggest you start again. Make a copy of the project then click twice slowly on the project name in the project navigator. You can then rename the project.
Xcode then suggests which files/resources to change - you can accept all changes or amend if you like.
Once complete your project will build and run with no problems.

Related

Create a framework from existing iOS project

I'm new to iOS development and I got this project and need to convert it to a framework so that I can simply add it into different projects. Can someone please help me with this.
I tried different tutorials, but all of them is to create one from new projects
When you want to make a framework, or module, from a project, the first thing you’ll need to do is, if you don’t have one already, make an Xcode project workspace (File > Save as Workspace) . The next step is to add a new framework “project” to your workspace (that could’ve been why you saw some resources telling you to make a new project) with File > New Project and choosing Cocoa Touch framework. When you add it, make sure you pick your workspace under both Add to and Group. Then you will need to migrate in the files that you wanted to be in this module — make sure to choose copy items if needed.
Here’s an article with more specific details on the process if you need it:
https://medium.com/kinandcartacreated/modular-ios-splitting-a-workspace-into-modules-331293f1090

Do I need to add my framework to project again and again after editing ios?

I have my own framework which I've made. I use this framework in another project I made. That is, after building my framework, Dragged the Product, .framework to Embedded Binaries of project.
However, I've to continuously make changes to the framework. So the process of dragging and dropping again and again is a lot of work. How to conquer this ?
Can someone tell the exact steps even if it means including the project as well ?
Copy the framework Project to your project folder.
Open your Project in xcode.
Right click on the Project File on left side of xcode and click on option "Add file to Project Name" and then select the framework project here.
Delete the Product .framework available in the embedded libraries and add the framework product properly.
So your goal is to 'deploy' changes made to .framework to all the projects you've already embedded it in previously. Here is one approach to it.
Create [myFramework]Targets.txt file where you'll be putting all the locations (directories) of your framework in different projects, line by line. It will have something like this:
~/Path/to/project/A/Frameworks
~/Path/to/project/B/Frameworks
~/Path/to/project/C/Frameworks
Create deploy_framework.sh file with script that will replace your framework everywhere you need. I'm definitely not the one you can call a Bash expert, by here is what it probably looks like:
for destination in $(<[myFramework]Targets.txt); do /bin/cp -rf /Path/to/updated/[myFramework].framework "$destination"; done
Now, whenever you're done with your framework changes, just run deploy_framework.sh from Terminal. Assuming your Xcode projects have existing reference to .framework and you didn't change its name, it should work.
NOTE: You might still need to do Clean+Build for your projects to compile with updated framework. I believe you can also tweak project settings to 'cache' builds less aggressively.
Let me know if it works for you, we might need to adjust script a bit, since I never tested it.

Is there any better way to rename an XCode project than the given one?

The given version is described here: How do I rename a project in Xcode 5?
But, as you can see from the following screenshot^, not everything gets renamed, and if one opens package contents, directory names etc. to try to manually change all the references, the project is broken afterwards, so you have to keep the old project name for sub directories etc., which granted is not a massive problem, but is intensely irritating, and I'm not enjoying being intensely irritated at work.
^ apologies for a screenshot, but there's too much information in it to transcribe to written text. Top two-thirds of screenshot is XCode project, bottom third a Finder window.
Renaming projects in xcode in one of the most annoying things in iOS development. I assume you want to rename your app. I faced this problem once and figured out a simple, clean way to do it.
Go back to the point where everything worked.
Open project in xcode and click on the project icon in the project structure( first file)
Go to the info tab
Search for Bundle Name. Most probably it will automatically be set to $(PRODUCT_NAME) which is a shell variable that will set your app name the same as the project name.
Set it to whatever you want your app name to be
Done
Notes :
If you use custom URL Schemes this might produce an error when redirecting.
ALWAYS git or some other SVN in your projects. This will come in handy in this kind of situations

How can I avoid having to clean the project after replacing files?

Xcode 4.5.2, using cocos2d-iphone 1.0.1 for game development.
Recently, I have realized that every time I replace an image file with one of the same name, the project in my device will continue using the old one when I create a CCSprite with such file.
This can be fixed by simply cleaning the project.
However, now the project is rather large, and compiling after cleaning takes quite an annoying amount of time.
Is it possible to replace files and make Xcode use the correct files instead of having to clean the project?
Another simple fix is to give a different name to the new file and delete the old, then change the CCSprite to use the new file name. Of course, this is ridiculous so I'd like to avoid doing it.
I believe that it also happens even when I just delete the app from the device - it seems I do have to clean the project.
Open Organizer in your Xcode. Goto the Projects tab.
you can see Derived data options. Click Delete near to that option, to clean your project

What is the right way to "save as" an iPad project?

I would like to build a new project based upon my existing. Since there are internal names that need to be changed to correspond with the project file names, I don't know the simple way to accomplish this without a mess.
Here are steps I have done:
Copy the whole folder of that project and rename the folder to whatever new name you want.
Following the direction in the answer from this SO to change the "product name".
That is it.
I would suggest you do NOT "save as" any project. Because to handle two copies of a same code is very very painful.
If you just want give your project a new name or make some new build settings, add a new "target" is good enough.
And if you want to use your existing project in another project, simply add it as a sub-project is a better way.
But just try to avoid to have many copies of one code, it's hard to maintain in the future.

Resources