iOS Development Summary-xcode common errors

Source: Internet
Author: User
Tags set set install cocoapods

This article contains the various errors that Xcode has encountered and gives the correct solution to the error to help a friend in trouble.

Article by the author Liu Xiaozhong maintenance and continuous updating, there are new problems and the article is not included in the comments in the following areas, I will be included in the article for your reference. If there is a problem that cannot be resolved, it can also be presented in the comments section below, I will do my best to help resolve it, and add the solution to the article for other people to refer to.

"file/file.h" file not found

If you encounter this type of problem error, can be divided into three parts to solve, from simple to complex step-by-step, until the problem location.
1. 点击Xcode -> Project -> Clean清除缓存或者使用? + ? + k快捷键来清除。
2. 点击Xcode -> Window -> Projects 清除Derived Data的缓存,在清除缓存之前先彻底退出Xcode,然后直接删除缓存文件夹。
3. 再Build Settings -> Header Search Paths 添加路径,$(SRCROOT)/项目名称/文件路径。

If none of the three methods above solve the problem, consider whether the file exists or if the import method is wrong. For example # include<> # include"" , # import<> # import"" If there is an error in the import mode of and, and.

4.2 or laterclang: error: linker command failed with exit code 1 (use -v to see invocation)

First Note: -pie can only be used when targeting iOS 4.2 or later -pie only available on ios4.2 or later, so you can change the projectDeployment Info —> Depoyment Target

If your IDE reported the following error:

auto property synthesis is synthesizing property not explicitly synthesized

Workaround:
project -> build settings -> Apple LLVM 6.0 - Warnings - Objective C -> Implicit Synthesized Properties -> NO.

This will eliminate all property warnings.

not be opened because you don‘t have permission to view it

Today using Xcode6, suddenly prompted me to "the file “XXX” could not be opened because you don‘t have permission to view it" say I do not have permission.
You can Build settings->Product Name .Product Name $(TARGET_NAME) modify any app name by default in item modification:

If you encounter the above situation, there is a way to resolve:
Project —> Build Setting —> Build Options —> Compiler for C/C++/Objective-CTo change this item into aDefault Compiler(Apple LLVM 6.0)

This approach can solve many problems caused by the compiler.

There are times when you encounter this type of error:

is incompatible with type ‘id <uitabbardelegate>’ inherited from ‘uitabbar’
UIKit agent's own defined agent

This is because your proxy property name and inherited parent class Proxy property name are the same, this situation only need to change their proxy property name can be.

However, this method is not a good solution, the best solution is to define the proxy, inherited from the parent class proxy. The advantage of this is that it conforms to the Objective-C inherited characteristics, and when the outside world uses the proxy of the current class, it is possible to obey the proxy of the current class, and it is more convenient for the outside world to use the agent of the parent class. And Apple officially did the same.

In storyboard , by controller A jumping to controller B the time and then error:

is not in the window hierarchy!

General analysis, it should be the case, in controller a the inside of the viewDidLoad direct jump controller b , and then led to the display at controller b the time also called controller a to display, and then found that window the hierarchy of the disorder.
In the controller a jump, to be in viewDidLoad and after the viewDidAppear jump, so you can think of ways to delay the jump, rather than jump directly. You can also write this method in other locations, depending on your situation.

"ViewController.xib" could not be opened. Unrecognized file content.

This error can be caused in many cases, most often due to the fact that the svn git version Control tool is being used for code update . After we have resolved the conflict, we will exit Xcode, delete the cache, and then find it in the list on the right Open AS -> Interface Builder XIB Documents .
This problem should be one of Xcode bug , it's not related to us.

import <framework/framework.h> file not found

We import a new framework post-report file not found error, or currently framework cause other framework report file not found errors, because the path caused the error, we need to specify the path of the program.
Workaround: In the Build Settings -> Framework Search Paths add path,$(SRCROOT)/项目名称/文件路径/文件名.framework

of relationship segues prior to ios 9.0

IOS9 after the Apple added a new feature-storyboard References, this feature if the above error, because this new feature only supports iOS9 and above, you need to set the minimum version of the Xcode compile to iOS9.

Deployment Target
not match that of the installed application. These values must match for an upgrade to be allowed.

The device already has the same identifier program as the current running program, need to remove the same identifier program on the device, or modify the identifier of the currently running program, and then run it again.

Identifier
not have an architecture that 设备名 can execute.

This problem is mainly due to the arm instruction set set by the project, which is higher than the device instruction set, that is, the project does not have an instruction set compatible with the lower version of the device. So we need to set a lower instruction set to be compatible with the lower version of the device, which is not an iOS version, but a hardware version, such as IPhone5, IPhone6, and so on.

ARM instruction Set

If you reset the device instruction set, the program does not run correctly, and the following error occurs:

failed to send the handshake ack

If from the error message, it is a handshake symbol sent failed, but it is not, and not because of the problem of the network. This is mainly due to the fact that we have the above arm instruction set error, which requires us to manually restore the system settings.

具体操作 : 通用 -> 还原 -> 还原所有设置 (这个操作越狱机慎重)
Variables View (控制台变量) 不显示变量的值和内存地址,很多对象都显示为nil,而实际上是有值的。

This is mainly because we will be setting the current project in Edit Scheme Build Configuration order to release model, in the release mode the compiler will simulate the real machine running state, some debugging parameters will be optimized, including the non Variables View -display variables.

So the solution is to Build Configuration change the release schema debug to the pattern, the value of the variable and the memory address.

type name ‘ViewController’;did you mean ‘UIViewController’?

Or

type name ‘ViewController’;

This is because of the two classes in the code that are caused by the use of a #import direct or indirect circular reference, which occurs at compile time. For example, a circular reference that has been in, classA #import or has classB classB #import classA been separated by several layers.

The workaround is to find the class that is referenced by the loop, and then reference it in a way that is used in the file of any class that produces a circular reference .h @class , and then use the reference in the class to .m #import resolve it.

not find Developer Disk Image

The problem lies in:
This situation is usually in the process of real machine debugging, because the test device system version is higher than Xcode the version of the runtime, so that Xcode the corresponding disk mapping file is not found.

Workaround 1:
For such a problem, we can be resolved by upgrading Xcode , as long as the Xcode upgrade to the highest version of the problem is resolved. Because the latest Xcode version of the runtime is always iOS higher or flat than the newest system, this approach can be solved, and that's what Apple wants.

However, the process of upgrading Xcode will lead Xcode to failure to open, serious impact on our work, and the Xcode volume is relatively large, the upgrade process for the speed of the higher requirements. and download one Xcode after also not necessarily immediately can use, sometimes Xcode upgrade, but mac OS version can't support Xcode , also to upgrade mac operating system, another day passed ...

Workaround 2: (personal recommendation)
For this problem, we can consider adding the iOS system corresponding to the DeveloperDiskImage file resolution, which is the above-mentioned Xcode disk mapping file, download and add this file on it.

Specific files can be downloaded directly from Google , after downloading directly in the following directory. For example, I want to run iOS9.3.1 the system now, I will download a file name 9.3 (13E230) of the file, and then put in this directory, you can run the real machine.
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/

A DeveloperDiskImage file can run all the sub-version numbers of the current medium version number, such as the file of the updated 9.3.1 system, DeveloperDiskImage can run 9.3.0 - 9.3.9 all the 9.3 beginning of the child version number, and for the other system versions the same.

Xcode Upgrade Policy:
For Xcode the upgrade, my own idea is only in 6.xx and 7.xx such a large version of the update, I will upgrade Xcode , other small version I will not go to upgrade. In order to ensure the real-time operation, iOS I will upgrade the disk mapping file in the above way after every update of the system, Xcode but Xcode I will not upgrade it.

This is mainly because the Xcode volume is relatively large, the upgrade is really not easy, and frequent upgrades Xcode there is no big change. In general 6.xx and 7.xx such a large version of the update, Xcode there will be a relatively large change, this time I will choose to upgrade Xcode .

is busy: Processing symbol filesXcode will continue when iPhone6 is finished
Processing symbol files

When the real machine is running, the above errors often occur, but the project configuration, certificates, equipment and so on are all right.

In fact Xcode , from the above progress information can also be seen, Xcode is processing symbol files. Xcodeeach time a new device is connected, this is done, only the first connection will be made, and then it will not. So what we have to do is, wait ...

Charles无法抓包

After downloading the Mac Charles , you can grab the package directly, and you can grab the packet after configuring the agent on the phone.
However, sometimes Charles there will be unable to grasp the package situation, re-uninstall and then install, or can not grasp the package.
In this case, you can follow the steps below to check if the configuration is a problem.

1. 查看Charles下面两个选项是否勾选,如果勾选将其取消。Proxy -> Proxy Settings -> Enable transparent HTTP proxying Proxy -> SSL Proxying Settings -> ->SSL Proxying -> Enable SSL Proxying2. 查看Charles下面选项是否勾选Proxy -> Mac OS X Proxy3. 如果用过Lantern或者其他FQ工具,需要检查下面选项是否勾选,很多FQ工具会配置下面选项。系统偏好设置 -> 网络 -> 高级 -> 自动代理配置

I can not use it because of the Charles third situation, what I do is to cancel it directly, test it and FQ as usual.

for -lBeeHiveclang: error: linker command failed with exit code 1 (use -v to see invocation)
Solution Solutions

This problem is generally caused by the lack of a library file , such as using a third-party library, but not importing its files, it will report such a mistake. Therefore, you need to find the missing library file and drag it into the project according to the prompt information.

If used CocoaPods , it is podfile the result of not updating the file, execute the pod command and reopen the project.

[!]the master repo Span class= "Hljs-selector-tag" >requires cocoapods 1 .0.0 -( Span class= "Hljs-selector-tag" >currently using 0 .39.0)  Update cocoapods, or checkout the  Appropriate tag in the repo.       

Upgrade Xcode 8 and Mac10.12 later, at pod update the time of discovery reported this error.

The upgrade CocoaPods failed after the attempt, as indicated by the error. Later thought is gem the problem, printed the gem address, there is no problem.

http://ruby.taobao.org/https://ruby.taobao.org/

Hurry Google up and check what's wrong. Later Mac10.11 , the system will CocoaPods move to the /usr/local/bin path. So reinstall it again CocoaPods , and specify the path, it's ready.

sudo gem install -n /usr/local/bin cocoapods

It is usually installed by not specifying a path, so it is installed to the CocoaPods default path.

sudo gem install cocoapods

If you re-install CocoaPods , or report the following error, then you need to change the Podfile file.

2.0)` is not used in any concrete target.

PodfileAdd the file target and run it again pod update .

dopod ‘ReactiveCocoa‘ , ‘2.0‘end

iOS Development Summary-xcode common errors

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.