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的形式打开,在最后加上这句话

<key>SBAppTags</key>
<array>
<string>hidden</string>
</array>

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!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值