Iphone 在当前时间更改应用程序名称
是否可以在运行时通过代码更改应用程序名称 如果可能,请快速回复。 我正在使用这个代码 `Iphone 在当前时间更改应用程序名称,iphone,ipad,Iphone,Ipad,是否可以在运行时通过代码更改应用程序名称 如果可能,请快速回复。 我正在使用这个代码 ` 您的代码看起来像是试图更改图标,而不是名称。他们中的任何一个都不可能在一个非越狱电话上。您无法编辑现有应用程序的捆绑包 您是正确的,应用程序包是只读的。因此,您无法编辑它们 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString
您的代码看起来像是试图更改图标,而不是名称。他们中的任何一个都不可能在一个非越狱电话上。您无法编辑现有应用程序的捆绑包 您是正确的,应用程序包是只读的。因此,您无法编辑它们
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];
}