ios 常見問題解決

 

一,libxml/HTMLparser.h file not findphp

第一種方法:
點擊左邊項目的根目錄,再點擊右邊的Build Settings,手工輸入文字:「Header search paths」,而後單擊(或雙擊,點擊彈出面板下面的「+」號進行添加)「Header search paths 」右邊的空白處,輸入:/usr/include/libxml2
第二種方法:
點擊左邊項目的根目錄,再點擊右邊的Build Settings,手工輸入文字:「Header search paths」,而後單擊(或雙擊,點擊彈出面板下面的「+」號進行添加)「 Header search paths 」右邊的空白處,輸入:${SDK_DIR}/usr/include/libxml2
html

二,老是找不到協議:ios

第一種方法:沒有引入該協議,引入該協議web

第二種方法:重複引入該協議,重複引入的地方刪除bootstrap

三,啓動畫面不顯示swift

1>,圖片大小尺寸必須符合規定,把全部的圖片導入工程中xcode

2>,進入工程Images.xcassets文件夾,把圖片拖入對應的AppIcon,LaungchImageapp

四,ld: library not found for -lcrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)
第一種方法:庫crypto沒有添加進Link Binary With Libraries,添加進去就OK了
第二種方法:庫crypto已經添加進Link Binary With Libraries,把crypto刪除再從新添加進去就OK了ide

 五,Unsupported compiler 'com.apple.compilers.llvmgcc42' selected for architecture 'armv7'  Xcode 5函數

Change your compiler for C/C++/ObjectiveC Go to Build Settings->Build OPtions->compiler for C/C++/ObjectiveC; select Default(Apple LLVM5.0)

六,關於ld: file is universal (2 slices) but does not contain a(n) armv7s slice

升級了xcode以後,支持iOS6和iPhone5,不過Build項目的時候,出現了標題所示錯誤提示信息。

緣由是引用的第三方庫致使了這個連接錯誤。

解決辦法有三個,隨便哪一種都能解決:
1.升級涉及到的.a文件
2.在target的Build Settings裏面,將Build Active Architecture Only改爲YES   (I choose this)
3.在target的Build Settings裏面,找到Valid Architectures,刪除其中的armv7s

因此仍是以爲,若是是開源庫,直接把源代碼包含進項目比較靠譜。

 七,使用第三方插件時,出現contentoffset下移20像素的狀況:

解決方案:在使用第三方控件的viewcontroller的viewDidLoad方法中添加下面的代碼便可

if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
        [self setEdgesForExtendedLayout:UIRectEdgeNone];
    }

八,提交app的時候會有no indentities were available for signing 提示

1.在Xcode的Organizer 中能夠看到你上傳項目的Indetifier

2,在Provisioning中能夠創建的文件和Indetifier保持一致

3,下載你所創建的Provisioning文件,而後雙擊

4,再在Organizer中上傳文件就能夠了

5,若是在代碼中做了修改,須要從新打包再上傳,上傳的纔會是最新的代碼

九,no matching provisioning profiles found

1,到Build Settings裏面從新選擇進入code signing

2,從新選擇profiles

十. mutating method sent to immutable object'
從字面上理解:可變的消息發給了不可變的對象。好比NSDictionary類型的對象調用setValue方法.應該把NSDictionary 改爲NSMutableDictionary類型。
十一.Local declaration of 'content' hides instance variable
通常是函數裏面定義的變量和class屬性變量重名了。不多有和系統變量重名的狀況
十二.unrecognized selector sent to instance
大部分狀況下是由於對象被提早release了,在不但願他release的狀況下,指針還在,對象已經不在了
不少時候,是由於init初始化函數中,對屬性賦值沒有使用self.foo賦值,而是直接對foo賦值,致使屬性對象沒有retain(內心覺得retain了),而提早釋放。
十三.使用ASIHTTPRequest編譯不經過
緣由是一些類庫沒有加進去。把這些庫加進去CFNetwork, SystemConfiguration, MobileCoreServices, and libz.dylib
十四.添加在UIView中的UIButton   單擊不起做用
緣由是UIbutton的frame超出了UIView的frame範圍。事實上UIView並無設置frame,設置完後( 範圍必定要在UIButton以外),UIButton單擊就能夠了
十五.當使用presentViewController和dismissPresentViewController時,若是報這個錯 : while  presentation is in progress

修改方法爲[mainView dismissModalViewControllerAnimated:NO];  將參數Animated改成NO;若是報這個錯while a presentation or dismiss is in progress,試試這樣

 if (![[mainView modalViewController] isBeingDismissed]) {
        [mainView dismissModalViewControllerAnimated:NO];
    }

十六.調用系統相冊的時候,很是容易出現內存警告,加入綠色代碼就會好點
        UIImagePickerController * picker = [[UIImagePickerController alloc]init];
        picker.delegate = self;
        picker.allowsEditing = NO;  //是否可編輯
        picker.videoQuality=UIImagePickerControllerQualityTypeLow;
        //攝像頭
        picker.sourceType = UIImagePickerControllerSourceTypeCamera;
        [self presentModalViewController:picker animated:YES];
        [picker release];

十七.ios開發者都碰見過得錯誤:EXC_BAD_ACCESS 。這個和第二個比較相似。一般的調試方法就是加入NSZombieEnabled變量,加入方法自行百度。

而且開發過程當中使用[[NSNotificationCenterdefaultCenter]

來發布本地消息,這個也常常會出現EXC_BAD_ACCESS錯誤。這個時候只須要在你的view活着viewControllers的dealloc的方法裏面加入

[[NSNotificationCenterdefaultCenter]removeObserver:selfname:@"yourNotification"object:nil];就ok了

十八.碰見一個蛋疼的問題"linker command failed with exit code 1 (use -v to see invocation)" 。

翻遍了找不到緣由。而後還有這樣的警告duplicate symbol _OBJC_CLASS 。原來是在導入某個類的時候導入.m文件,而不是.h文件

十九:clang failed with exit code 254

檢測代碼中 是否 有 NSLog 打印了 返回 void 的值.

二十:Verify exit code of build task with internal identifier 'CopyPNGFile 123.png'

加載中...\

一:將出錯的png,用PhotoShZ喎�"http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcNbY0MLXqru70ru0ziwgIMjnuftQaG90b1Nob3C08rK7v6osuMS689e6zqpKcGcgytTK1C4g16q7u8qxLMfryrnTwyA6PHN0cm9uZz605rSizqpXZWK78snosbjL+cq508O1xCYjMjY2ODQ7yr08L3N0cm9uZz4mIzI2Njg0O8q916q7u7PJPHN0cm9uZz4gUE5HLTI0PC9zdHJvbmc+1eLR+bXEzbzGrLTz0KGxyL3Pus/KyjwvcD4KPHA+Cjxicj4KPC9wPgo8cD4KPHN0cm9uZz4zOjwvc3Ryb25nPjwvcD4KPHA+CjxpbWcgc3JjPQ=="http://www.2cto.com/uploadfile/2014/0509/20140509112551421.png" alt="\">\

一:肯定靜態庫中是否有自定義的類文件,若是一個也沒有,就會出現這種錯誤,這也是爲何新建的靜態庫都包含一個默認的類.

二十一: _OBJC_CLASS_$_UIMainKpiXML", referenced from:

1:檢測類文件是否已經指定了Project Target

加載中...\

2:檢測類文件是否在Bulid Phases 中的 Compile Source 是否包含了這個類文件

加載中...\

以上兩步都檢查完成之後,若是編譯還報錯誤,請嘗試完全關閉XCode 再次編譯試試.

二十二: for architecture armv7s

 

\

如下摘自: http://stackoverflow.com/questions/12570116/what-is-the-difference-between-arm7-and-arm7s

Yes you are right about armv7s is about the iPhone 5. Here some summary info I found on the web:

  • ARMv6 ISA (used by the ARM11 core in the iPhone 2G and iPhone 3G)
  • ARMv7 (used by modern ARM cores, iPhone 3GS, iPhone 4 and 4S)
  • ARMv7s (new A6 SoC for iPhone 5).

    注:錯誤含義表示 指定的framework 不支持對 armv7s 的支持, 也就不支持搭載A6處理器的iPhone 5.

    若是在編譯framework或者靜態庫的工程中依舊編譯時,多是如下設置致使,設置爲NO便可

    \

二十三: Local declaration of "' hides instance variable

私有變量與屬性變量同名所致

二十四:Instance variable '' accessed in class method

加載中...\

1:在靜態方法不能使用到類的屬性變量,不然就報上面的錯誤

二十五:ld: symbol(s) not found for architecture i386

加載中...

1:裏面意思說:"_stroyboard" 這個屬性在目標類中 根本就沒聲明!

\

那就聲明一下咯? 注:XCode4.5 會默認聲明瞭,可是隻是針對自定義類,系統類尚未. 因此,當心

 @synthesize storyboard;

二十六:PerformSelector may cause a leak because its selector is unknow

經過以下代碼解決產生的編譯器警告

#pragma clang diagnostic push

#pragma clang diagnostic ignored "-Warc-performSelector-leaks"

[self performSelector:nextView];

#pragma clang diagnostic pop
來源:(http://www.ooso.net/archives/620)

二十七:unable to open executable

1:檢測同一個靜態庫或工程中是否有兩個或以上的想同類文件存在

2:刪除模擬器中的應用,刪除DerivedData文件夾 從新啓動XCode.

二十八: Property's synthesized getter follows Cocoa naming convention for returning 'owned' objects

不要在頭文件聲明變量命名是以new copy開頭

參考:http://kongbei888.blog.163.com/blog/static/24326613201261902510652/

二十九:ld: file not found:

1:指向的靜態庫沒有找到

\


三十: _utf8_countTrailBytes

add library libicucore.dylib

三十一:Stray "@" in program

工程使用的編譯器版本太低所致. 修改編譯器版本至最新版本,以下圖:

加載中...\

參考:http://stackoverflow.com/questions/12821938/stray-in-program-with-nsdictionary-definition

三十二.解決真機調試iPad Air設備時的錯誤:architecture not supported的辦法

1.將Build Settings 中Architectures ——> Valid Architectures的arm64刪掉,只留armv七、armv7s

2.同上,將Architectures ——>Architectures改成 $(ARHS_STANDARD)armv7,armv7s

3.把Build Active Architecture Only 改成NO

4.編譯便可

三十三.編譯時出現:Not supported ARM architecture

解決辦法:在./configure 時加入 -D__ARM_ARCH_5TEJ__

三十四.Couldn"t register xxx.xx.xx with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.
每一個在xcode下用ios模擬器作開發的開發者都應該會遇到過上面所示的錯誤,目前找到最行之有效的解決辦法是重啓手機。不行了也順便把電腦重啓下。 建議之後記得stop就好了 不要正運行着就直接卸載了程序

三十五.duplicate symbol _protobuf_c buffer_simple_append in ...錯誤解決

 選中工程,target,切換到buildsetting標籤,定位到other link flag,

輸入: 去除-all_load,便可

三十六.ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architectur

錯誤:ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture i386

緣由:不支持低版本的系統如3.0

解決:Deployment Target was 3.0. Changing it to 4.3 fixed it.

三十七.當一個tableViewCell被選中的時候,改變一個button的title,這個button有背景圖片,改變title不成功

把該button的selected設爲NO

三十八.CUICatalog: Invalid asset name supplied: , or invalid scale factor: 2.000000

這個提示的意思是說你用了這個方法

[UIImage imageNamed:name];可是這個name倒是空的,因此就報了這個錯了。

解決方法,在項目中搜索[UIImage imageNamed:,而後打印看看所謂的name是否爲空。找到後替換。

三十九.XCode開發遇到的「Could not inspect the application package」解決方案

出現這種狀況的緣由是:項目裏含有 Resources 文件夾。解決方案:

1>在項目裏把這個 Resources 文件夾 改成別的名字(不要在項目裏改文件夾的名字,這是僞改,要進入工程文件夾再改 Resources 名字),再從新引入這個文件夾

2>按住 option 鍵 ,點擊 Xcode 的product 菜單,選中 Clean Build Folder ,而後肯定 clean 就OK了

四十.Xcode has encountered an unexpected error (0xC002)

解決方法
Xcode has encountered an unexpected error (0xC002) No such file or directory, at ‘/SourceCache/DTDeviceKit/DTDeviceKit-867/DTDeviceKit/DTDeviceKit_Utilities.m:864’ Xcode has encountered an unexpected error (0xC002) No such file or directory, at ‘/SourceCache/DTDeviceKit/DTDeviceKit-867/DTDeviceKit/DTDeviceKit_Utilities.m:864’

cd ~/Library/Developer/Xcode/iOS\ DeviceSupport/4.2.1\ \(8C148\)/Symbols/System/Library/Caches/com.apple.dyld/ 

touch .copied_dyld_shared_cache_armv6 

touch .processed_dyld_shared_cache_armv6 
touch dyld_shared_cache_armv6
有些多是 
touch .copied_dyld_shared_cache_armv6
touch .processed_dyld_shared_cache_armv6 
touch dyld_shared_cache_armv6

四十一.An error was encountered while running(Domain=LaunchSerivcesError, Code=0)

解決方案:重置模擬器

 四十二.Undefined symbols for architecture i386:
  "_NSFileTypeForHFSTypeCode", referenced from:
      -[FMDatabase(FMDatabaseAdditions) applicationIDString] in FMDatabaseAdditions.o
  "_NSHFSTypeCodeFromFileType", referenced from:
      -[FMDatabase(FMDatabaseAdditions) setApplicationIDString:] in FMDatabaseAdditions.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

解決辦法:把FMDatabase文件刪除了,再從新導入全部的文件

四十三.fatal error: malformed or corrupted AST file: 'Unable to load module "/Users/xxx/Library/Developer/Xcode/DerivedData/ModuleCache/XYZYIE6ZV0OP/Darwin.pcm": file not found' note: after modifying system headers, please delete the module cache at '/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache/XYZYIE6ZV0OP' 1 error generated.

 解決辦法:

只須要清除繼承數據文件夾便可。具體操做爲:進入XCode的Window,選擇Organizer->Projects,而後選擇出現問題的 project ,點擊delete button刪除Derived data.

從新編譯項目,便可。

四十四.Command /usr/bin/codesign failed with exit code 1

進入xcode 的偏好設置 -》Account以下圖

點擊第二張圖右下角的刷新按鈕,從新編譯打包,就OK了

四十四.the ipa is invalid.it does not include a payload directory

須要在info-plist 文件中 添加或者修改 LSRequiresIPhoneOS value 爲 YES

四十四.iOS9 beta 請求出現App Transport Security has blocked a cleartext HTTP (http://)

錯誤描述:

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app‘s Info.plist file.

 

在iOS9 beta中,蘋果將原http協議改爲了https協議,使用 TLS1.2 SSL加密請求數據。

解決方法:

在info.plist 加入key

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

  

四十五.Could not find Developer Disk Image

真機系統過高,Xcode支持不到這個系統,要有這個系統版本的鏡像文件 ,/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport ,會列出支持的設備,而後在網上下載對應的文件

 

四十六.UICollectionView 會在APP再次打開時下沉64像素

方案一:在Storyboard中取消勾選Controller的Adjust Scroll View Insets。或者  

 self.automaticallyAdjustsScrollViewInsets = NO;

 

方案二:

self.edgesForExtendedLayout = UIRectEdgeNone;

 

 

四十六.dyld: Library not loaded: @rpath/libswiftAVFoundation.dylib
Referenced from: /var/mobile/Containers/Bundle/Application/AC4B5FD7-43B3-4743-9682-60A026C5CAE2/NewFoodiPad.app/NewFoodiPad

rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"

rm -rf ~/Library/Developer/Xcode/DerivedData

rm -rf ~/Library/Caches/com.apple.dt.Xcode

 

四十七.swift項目 ios8系統 SVProgressHud crash在 self.hudView.motionEffects = @[];

self.hudView.motionEffects = [NSArray array];

 

四十八.swift項目 ios8  dyld: Symbol not found: ___NSArray0__

dyld: Symbol not found: ___NSArray0__
  Referenced from: /private/var/mobile/Containers/Bundle/Application/5C6F5D69-5D14-4C07-BEA4-F410C18C66CC/DGBao.app/DGBao
  Expected in: /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /private/var/mobile/Containers/Bundle/Application/5C6F5D69-5D14-4C07-BEA4-F410C18C66CC/DGBao.app/DGBao

解決辦法:

 

改成 optinal

四十九.The maximum number of apps for free development profiles has been reached.

免費應用程序調試最大限度
蘋果免費App ID只能運行2個應用程序,當調試第三個的時候就會報這個錯誤,咱們必須把以前的應用程序刪除,就能夠調試新的了


五十.「(null)」 is of a model that is not supported by this version of Xcode.
今天真機運行遇見了這個問題(「(null)」 is of a model that is not supported by this version of Xcode. Ple),發現將XCode重啓後就能夠真機運行了,遇見這個問題的朋友能夠試下

相關文章
相關標籤/搜索