5

I know there are so many answers related to my question, such like.

Programmatically rename an XCode project
Renaming xcode 4 project and the actual folder

etc.

But look at following my code:

NSString *plistPath = @"...../TestingAPI-Info.plist";
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc]initWithContentsOfFile:plistPath];
[dictionary setObject:@"myTestingApp" forKey:@"CFBundleDisplayName"];
[dictionary writeToFile:plistPath atomically:YES];

I am changing the name of apps icon by above code,

enter image description here

Changed name "MySuperApp => myTestingApp"

SO, Is it valid to change by using above code ? I have fear of app rejection ?? I also want to set all changes through above code like, Bundle identifier, Bundle name..etc ?

Is it valid or not ?? By using above code apple reject my application or not ??

Community
  • 1
  • 1

3 Answers3

4

As rckoenes said correctly, this won't work on the device. Any bundle contents are readonly, including the info.plist. You can not overwrite it.

To clarify: Just open up the Info.plist file in Xcode and rename it to whatever you want. You don't need any code for this. You will find the YourProjectName-Info.plist file within your Xcode project.

calimarkus
  • 9,955
  • 2
  • 28
  • 48
  • 1
    Thanks for replay - But if I want to change app name for only once and also after name is changed in simulator then I want to upload to AppStore so anything is wrong ? apple reject it or not ?? i also want to change Bundle identifier, Bundle name..etc ? –  Mar 24 '14 at 09:27
  • @TheKing the app store rules don't matter. It's impossible to change the name of an app. You can do it during development but you can't do it when it has been deployed by the store. You would have to jail break the phone to do what you're trying to do. – Abhi Beckert Mar 24 '14 at 09:41
  • Just open up the Info.plist file in Xcode and rename it to whatever you want. You don't need any code for this. You will find the `YourProjectName-Info.plist` file within your Xcode project. – calimarkus Mar 24 '14 at 09:53
2

The writeToFile call will not work i.e. the contents will never get update in the Info.plist file. API call may return a false success but contents of that file will never change since application bundle is read-only (obviously the contents within it as well).

As per Appstore review guidelines there is one which suggests,

2.6 Apps that read or write data outside its designated container area will be rejected.

But whether app bundle falls under "designated container area" is a matter of speculation because only Apple can clarify this. AFAIK I have not read anywhere about app getting reject for attempting to write into application bundle.

As a side note: It may not be a good idea to change application name randomly without the users consent.

Hope that helps!

Amar
  • 13,202
  • 7
  • 53
  • 71
0

This is very unusual, app name is your brand it is finalized with lot of suggestions and thinking. What is benefits of this and why is your requirements to change name likewise.

Macrosoft-Dev
  • 2,195
  • 1
  • 12
  • 15