2011-12-05 17 views
-2

可能であれば、実行時にコードでアプリ名を に変更することが可能です。 私はこのコード `現時点でアプリ名を変更

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
      NSString *documentsDirectory = [paths objectAtIndex:0]; 


      NSString *myPathDocs = [documentsDirectory stringByAppendingPathComponent:@"SelectedImages.plist"]; 

      if ([[NSFileManager defaultManager] fileExistsAtPath:myPathDocs]) 
      { 
       NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"Info" ofType:@"plist"]; 
       NSFileManager *fileManager = [NSFileManager defaultManager]; 
      [fileManager copyItemAtPath:resourcePath toPath:myPathDocs error:NULL]; 



       NSDictionary *dic = [[NSDictionary alloc]initWithContentsOfFile:myPathDocs]; 

       //dic = [[NSBundle mainBundle] infoDictionary]; 
       NSMutableArray *arr =[dic objectForKey:@"CFBundleIconFiles"];   
       NSLog(@"Number of items %d",[arr count]); 
       NSLog(@"object %@",[arr objectAtIndex:0]); 
       [arr replaceObjectAtIndex:0 withObject:@"Icon.png"]; 
       NSLog(@"object %@",[arr objectAtIndex:0]); 
       [arr writeToFile:myPathDocs atomically:YES] ; 

       [NSBundle bundleWithPath:myPathDocs]; 

       //[[NSBundle mainBundle]setValuesForKeysWithDictionary:dic]; 
       [arr release]; 
      } 

答えて

2

あなたはそれのように見えますが、アイコンではなく、名前を変更しようとしている必要があり、コードを使用しています。いずれか1つは、ジェイルブレークしていない電話機AFAIKでは使用できません。既存のアプリのバンドルは編集できません。

+0

正しいですが、アプリケーションバンドルは読み取り専用です。したがって、それらを編集することはできません – rckoenes

関連する問題