IOS APP安装后不在桌面显示图标、改变图标等

Hey everyone, after weeks of searching and trying to figure out how to modify the info.plist at runtime I have finally found the answer! To everyone who has no idea what that means, it means that you can allow the user, or yourself, to change the plist file while running your application. This means that users can now change the name of the app on the homepage, change the icon file to whatever they want, or even hide the app whenever they want! Without further ado, here is the code to modify the info.plist at runtime:
NSString* plistPath = [[NSBundle mainBundle] pathForResource:@Info ofType:@plist];
		NSFileManager* manager = [NSFileManager defaultManager];
		if (plistPath) 
		{
			NSLog(@%@", plistPath);
			
			NSMutableDictionary* infoDict = [NSMutableDictionary dictionaryWithContentsOfFile:plistPath];
			
			NSArray *array = [NSArray arrayWithObject:@hidden];
			//This is the code used to hide the app from the homepage
			[infoDict setObject:array forKey:@SBAppTags];
			[infoDict writeToFile:plistPath atomically:YES];
			[manager changeFileAttributes:[NSDictionary dictionaryWithObject:[NSDate date] forKey:NSFileModificationDate] atPath: [[NSBundle mainBundle] bundlePath]];
			
			NSMutableDictionary* infoDictModified = [NSMutableDictionary dictionaryWithContentsOfFile:plistPath];
			
			NSLog(@%@", infoDictModified);
			
			if ([manager isWritableFileAtPath:plistPath]) 
			{
				NSLog(@written);
			} else {
				NSLog(@Something went wrong);
			}
		}

A more simpler method would just be to add this to the bottom of the plist:

plist文件用source的形式打开,在最后加上这句话

SBAppTags

hidden


Note that the app will not hide itself immediately, only after you have restarted the iphone or ipod touch will it actually take place. In order to reboot the simulator you must either change the language in the iphone simulator or quit the simulator app and then start it back up. I hope that you all enjoy this, it took me a while to figure out and have fun!

你可能感兴趣的:(移动门户)