Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When using cocoapods, what is the best way to change the PRODUCT_NAME?

I created an app with name "ABC". Months later I decided to change the name to "ABCD". I believe the way I changed it, was in my Podfile, I changed target "ABC" do to target "ABCD" do. However, I recall going through quite a few issues/errors afterward in my workspace that caused a lot of stress. It was so long ago that I can't quite recall though.

Now I'm ready to submit, and I want to change the name one last time. I've changed the name in iTunes Connect, but now I want to change my PRODUCT_NAME, and my bundle identifier to match.

What is the best way to do this? Should I change the target fields in my Podfile? Or should I leave them, and just change something else in Xcode? Or do I need to change both or more than one thing?

like image 443
chris P Avatar asked Jun 29 '15 16:06

chris P


2 Answers

When you have a Pod file the .xcworkspace and Pods.xcodeproj is generated dynamically by the pod install process.

So one way to deal with this is

  1. Change your product name
  2. Close the project in Xcode
  3. Discard the existing .xcworkspace, Pods folder & Podfile.lock
  4. Run pod install again.

The cocoapods engine will regenerate its project, pull the Pods from its cache and recreate its Pods.xcodeproj with the new project settings.

This might be a little more complex in the case where you have other dependancies besides your main project and the Pods project in your workspace.

You'll probably want to have everything committed to source control before you do this so you can revert if it goes wrong.

like image 188
Warren Burton Avatar answered Sep 17 '22 08:09

Warren Burton


I solved if for my project with this steps.

  1. I install cocoapods-deintegrate

    [sudo] gem install cocoapods-deintegrate

    and call pod deintegrate on my project.

  2. open XCode, click on project name and click again with delay to rename, follow xcode instructions

    enter image description here

  3. run pod install again on your project.

  4. NOTE: if you are just Capitalising, or Uppercassing project name do it with other temp name: for me locdel->aaa->Locdel.

like image 30
Sergey Sahakyan Avatar answered Sep 17 '22 08:09

Sergey Sahakyan