1.iOS判断当前系统语言:
NSArray* languages = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"];
NSString* preferredLang = [languages objectAtIndex:0];
NSLog(@"Preferred Language:%@", preferredLang);
判断英文环境:[preferredLang hasPrefix:@"en"]
判断中文环境:[preferredLang hasPrefix:@"zh-Hans"]
- Openoffice 导出公式
=CONCATENATE("""";C2;"""";" = ";"""";"";D2;"";"""";";”)
Microsoft Excel 导出公式=CONCATENATE("""",C2,"""","=","""",D2,"""",";")
3.info.plist 国际化
用键名来进行国际化,例如:
/*
InfoPlist.strings(English)
*/
//访问权限
"NSAppleMusicUsageDescription"="Grant permission, to access music";
"kTCCServiceMediaLibrary"="Grant permission, to access music";
"NSBluetoothPeripheralUsageDescription"="Grant permission, to access bluetooth";
"NSCameraUsageDescription"="Grant permission, to access camera";
"NSHealthUpdateUsageDescription"="Grant permission, to access Apple health";
"NSLocationAlwaysUsageDescription"="Grant permission, to access location";
"NSPhotoLibraryUsageDescription"="Grant permission, to access album";
/*
InfoPlist.strings(Chinese)
*/
//访问权限
"NSAppleMusicUsageDescription"="App需要您的同意,才能访问音乐";
"kTCCServiceMediaLibrary"="App需要您的同意,才能访问音乐";
"NSBluetoothPeripheralUsageDescription"="App需要您的同意,才能访问蓝牙";
"NSCameraUsageDescription"="App需要您的同意,才能访问相机";
"NSHealthUpdateUsageDescription"="App需要您的同意,才能访问苹果健康";
"NSLocationAlwaysUsageDescription"="App需要您的同意,才能始终访问位置";
"NSPhotoLibraryUsageDescription"="App需要您的同意,才能访问相册";
4.iOS图标尺寸
40x40 60x60 58x58 87x87 80x80 120x120 180x180 1024x1024
5.iOS启动图 尺寸
4s : 640 x 960 对应iPhone Portrait iOS 7-9 2x
5s : 640 x 1136 对应iPhone Portrait iOS 7-9 Retina4
6 : 750 x 1334 对应iPhone Portrait iOS 8,9 Retina HD 4.7”
6p : 1242x 2208 对应iPhone Portrait iOS 8,9 Retina HD 5.5”
x : 1125x2436 对应iPhone Portrait iOS 11+
注意,一个像素也不能少,位置也必须放对,不然会出现黑边。
6.区分真机和虚拟机执行不同代码
#if TARGET_IPHONE_SIMULATOR //模拟器
#elif TARGET_OS_IPHONE //真机
#endif
7.点击UIButton上面的字体没反应 点击空白处才有效果的原因
( 1 )可能是titleLabel的userInteractionEnabled打开了
( 2 ) 可能是titleLabel的frame超出了UIButton的范围
( 3 ) 可能是在非安全区
8.定位权限
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>App需要您的同意,才能始终访问位置</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>App需要您的同意,才能在使用应用期间允许访问位置信息</string>
9.安装cocoapods
sudo gem install -n /usr/local/bin cocoapods
pod setup
10.如果您的构建版本未使用加密,请在 Info.plist 文件中使用键字符串值,这样您无需为下一构建版本提供出口合规证明信息。
<key>ITSAppUsesNonExemptEncryption</key><false/>










网友评论