- 在開發(fā)中,經(jīng)常會遇到各種意想不到的問題纬乍。踩過了坑碱茁,自然就知道了躲坑和填坑的方法。這篇文章將自己解決問題的方法分享給大家(持續(xù)更新)
- 有時 pod install 或者 pod update 會卡在 Analyzing dependencies 好久仿贬,是因為這兩個命令執(zhí)行時會更新 CocoaPods 的 spec 倉庫纽竣,替換為如下命令可跳過這一步
pod install --verbose --no-repo-update
pod update --verbose --no-repo-update
- 在 xib 中需要設置圖片圓角時,不必拖線寫代碼
self.headView.layer.cornerRadius = 30;
self.headView.layer.masksToBounds = YES;
只需在右側進行如下設置即可實現(xiàn)圓角
- 當使用 git 向倉庫中 push 代碼時茧泪,經(jīng)常會有 .DS_Store 文件沖突蜓氨。這是存儲文件位置信息的文件,創(chuàng)建 .gitignore 文件队伟,如下編輯穴吹,即可忽略該文件
# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
- iOS 10 之后的權限獲取,需在 Info.plist 中新增如下配置
<key>NSAppleMusicUsageDescription</key>
<string>App需要您的同意,才能訪問媒體資料庫</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>App需要您的同意,才能訪問藍牙</string>
<key>NSCalendarsUsageDescription</key>
<string>App需要您的同意,才能訪問日歷</string>
<key>NSCameraUsageDescription</key>
<string>App需要您的同意,才能訪問相機</string>
<key>NSHealthShareUsageDescription</key>
<string>App需要您的同意,才能訪問健康分享</string>
<key>NSHealthUpdateUsageDescription</key>
<string>App需要您的同意,才能訪問健康更新 </string>
<key>NSLocationAlwaysUsageDescription</key>
<string>App需要您的同意,才能始終訪問位置</string>
<key>NSLocationUsageDescription</key>
<string>App需要您的同意,才能訪問位置</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>App需要您的同意,才能在使用期間訪問位置</string>
<key>NSMicrophoneUsageDescription</key>
<string>App需要您的同意,才能訪問麥克風</string>
<key>NSMotionUsageDescription</key>
<string>App需要您的同意,才能訪問運動與健身</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>App需要您的同意,才能訪問相冊</string>
<key>NSRemindersUsageDescription</key>
<string>App需要您的同意,才能訪問提醒事項</string>
- Xcode 8 中 "xxx is missing from working copy" 警告解決方法
做畢業(yè)設計嗜侮,調整目錄結構后發(fā)現(xiàn)出現(xiàn)好幾個 "is missing from working copy" 的警告港令,這是以前沒出現(xiàn)過的,強迫癥不能忍啊有木有锈颗。解決方法如下:
(1) 取消勾選 Enable Source Control
Xcode->Preferences->Source->Enable Source Control
(2) 直接在終端操作
如果使用 git
git rm xxx
如果使用 svn
svn delete xxx