Installing different versions of the same iPhone p

2020-08-14 10:55发布

问题:

While I'm prototyping games, I frequently need to go back to compare with older versions, to better get a feel of if I'm on the right track or not. But it's a lenghty process to have to check out the old version and re-export everytime I need to check a specific version. It'd be so much smoother if I could simply launch different versions.

How can I have multiple versions of the same project installed on the device?

回答1:

If you give the programs different bundle identifiers, they can be installed on the same device. Possibly add a new build target that appends a random number (or build revision, or svn revision, etc) onto the end of the bundle identifier (and possibly the application name), then you can have multiple versions installed at once.

For example, you might have the application "com.mycompany.mygame" with the title "MyGame", and your script would create versions such as "com.mycompany.mygame43" with the title "MyGame43".

However, this may be defeated by Apple's love of making everything difficult for developers, also known as code signing. I personally don't do much App Store development, but I know the provisioning profiles can be a huge pain and they may have issues with this approach. Who knows.

Edit: guess it does work with code signing, but not in-app purchases.



回答2:

You'll need each version to have a different bundle identifier.

You could create a script that edits your Info.plist to append the version number to the bundle identifier and create a custom build phase to run the script for you... or you could just edit the bundle identifier manually.



回答3:

I do this, and works for me: I use the same project with different Product names.

1.Changing the product name

XCode Group & Files pane -> Targets -> projectName ->(Ctrl+Click)Get Info ->Build -> Product Name.

That enables me to create many apps (with different names according to version eg. AppName1.1, AppName1.2) on the same device using same provisioning profile.

2.For each project, I create Folder with the ProductName just to for identification purposes.

So project with Product Name AppName1.1, will be contained in folder AppName1.1 etc. I include a small readme.txt when I make many changes in the version folder.

The Project name remains the same, coz if I change it won't work.



回答4:

Edit to highlight the previously third option and the way I now manage this problem:

I would use Source Control to tag each version - so that it is easy to get back to the code for a previous version. It should be possible to check-out the tagged project in a separate folder (I use Subversion for this).

Once you have the older version in a separate directory then change the Bundle Identifier - add on the tag name and build etc. When changing the bundle identifier - make sure that you do not change the initial number and the app should still work with your provisioning profile. This assumes that you have a wildcard provisioning profile that you are using for development. If you need to include Nofifications or the In-App purchases this may not be possible.

=============================

Previous version of answer:

I have a quick trick that I use to hold versions - I use different versions of the Simulator and during development I keep moving between the different versions. If you are doing this with the simulator you can also move the files around.

However on the device then you are going to have to change your bundle identifier as mentioned. I would edit the bundle version each time I would like to freeze the functions and move on to a new phase.

Another option would be to use your version control to tag each of your versions allowing you to go back to the previous versions as seperate projects should you need to and you could then alter the bundle identifier and install as a seperate version.

Now I have written this reply I think I will starting using option 3 and tagging my versions better in SVN and use this method as it is a little less random than having to remember what version is in which simulator and it will allow me to deploy on devices too.



回答5:

I just compress my entire project into a zip whenever i reach a milestone. Then if i need to go back and reference it or run it i can just extract it and compile and i have two separate versions i can switch between. This isn't the most elegant solution but it is fairly easy to do and you can throw all your backups onto and external harddrive for safe keeping.



标签: iphone