1. 命令行显示/隐藏文件
defaults write com.apple.finder AppleShowAllFiles -bool true
defaults write com.apple.finder AppleShowAllFiles -bool false
2. 配置bugly符号表
- 取得dSYM文件 ,项目上架打包的时候,archive的文件,“ 使用Finder前往路径~/Library/Developer/Xcode/Archives/,可以看到日期目录,目录下有后缀名为xcarchive的文件,选中该文件,右键菜单选择“显示包内容”,可以看到一个dsYMs目录,将目录中的XXX.app.dsYM文件拷出来,后面分析会用到。”如果没有是因为XCode配置没有设置生成它 ,在Build Settings------>Debug information format ----选DWARF with dSYM File ,打包时就会生成dsYM文件
- command+B工程,在打开xxx.app所在文件目录,并把dsym文件拷贝到该目录下
- 打开终端 java -jar /Users/wmh/bin/buglySymboliOS.jar -i /Users/wmh/Desktop/dsym/GS_Mobile.app.dSYM -o fuhaobiao.zip
java -jar 【这一块是java包路径】 -i 【dSYM文件路径】 -o 【生成的文件名称】 - 上传符号表文件
3. git的忽略文件
<p>
Xcode
gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
Build generated
build/
DerivedData/
Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
Other
*.moved-aside
*.xcuserstate
Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
CocoaPods
We recommend against adding the Pods directory to your .gitignore. However
you should judge for yourself, the pros and cons are mentioned at:
https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
Pods/
Carthage
Add this line if you want to avoid checking in source code from Carthage dependencies.
Carthage/Checkouts
Carthage/Build
fastlane
It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
screenshots whenever they are needed.
For more information about the recommended setup visit:
https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
Code Injection
After new code Injection tools there's a generated folder /iOSInjectionProject
https://github.com/johnno1962/injectionforxcode
iOSInjectionProject/
</p>
4. 创建pch文件
- other里选择pct文件
- BuildSetting-->PrecompilePrefixHeader-->YES
- BuildSetting-->PrefixHeader-->$(SRCROOT)/AAAAAA/BBBBBB.pch
5. 新pod导入命令行
pod update --verbose --no-repo-update
6. KVO的实现原理
KVO是基于runtime机制实现的
[p addObserver:self forKeyPath:@"age" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil];
程序运行完这句话后,系统会动态创建一个p的子类,此时可打印p的isa指针,可以看到此时isa指针指向新创建的那个子类,在那个子类里面它重写了属性age的set方法,在这个set方法里先是调用了父类的setAge方法,然后发出通知,让系统调用- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
这个方法
7. 怎么让通知中心执行耗时操作
如果通知是在主线程发,那么执行方法也在主线程,就不可以执行耗时操作;如果通知是在子线程发,那么执行方法也在子线程,此时就可以执行耗时操作
8. IOS10权限
<key>NSPhotoLibraryUsageDescription</key>
<string>App需要您的同意,才能访问相册</string>
<key>NSCameraUsageDescription</key>
<string>App需要您的同意,才能访问相机</string>
<key>NSMicrophoneUsageDescription</key>
<string>App需要您的同意,才能访问麦克风</string>
<key>NSLocationUsageDescription</key>
<string>App需要您的同意,才能访问位置</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>App需要您的同意,才能在使用期间访问位置</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>App需要您的同意,才能始终访问位置</string>
<key>NSCalendarsUsageDescription</key>
<string>App需要您的同意,才能访问日历</string>
<key>NSRemindersUsageDescription</key>
<string>App需要您的同意,才能访问提醒事项</string>
<key>NSMotionUsageDescription</key> <string>App需要您的同意,才能访问运动与健身</string>
<key>NSHealthUpdateUsageDescription</key>
<string>App需要您的同意,才能访问健康更新 </string>
<key>NSHealthShareUsageDescription</key>
<string>App需要您的同意,才能访问健康分享</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>App需要您的同意,才能访问蓝牙</string>
<key>NSAppleMusicUsageDescription</key>
<string>App需要您的同意,才能访问媒体资料库</string>
网友评论