Ios编译问题

来源:互联网 发布:保定seo服务 编辑:程序博客网 时间:2024/05/30 04:59

1、error: failed to attach to process ID 0

error: failed to attach to process ID 0

出现此错误的现象:项目run build successes 但是IOS模拟器不能运行 项目自动stop。

解决方法一:  IOS模拟器   还原内容和设置

如果方法一不能够解决问题那么,查看一下你的项目里面是否有 Resources 等之类关键词命名的文件或文件夹。我项目不能运行的原因就是因为在项目里面包含了 Resources 的文件夹。

2、xcode build error ...

当误从project中去除 一些 FrameWork 时候,便会出现 ....referenced from:” 之类的错误,

 

如当误删 Foundation.Framework 时候,将会出现

.objc_class_name_NSObject,reference from:

.objc_class_name_HelloWorldAppDelegate in HelloWorldAppDelegate.o

Synbol(s) not found

Collect2: id returned 1 exit status

http://blog.csdn.net/gsherofly/article/details/8539062   bug调节

3、No such of file or dictionary......

靠,这样的错误折磨的我都想把mac给摔了。


再出现这样的错误 ,首先要看看你的项目里面是不是缺哪一个包,其次就是该导入的框架是否导入。没有别的原因。。。

4libxml/tree.h file not found

今天调试一个程序,用了友盟的统计工具

出现这么一个错误    libxml/tree.h file not found  

解决办法:

    设置Header Search Paths 为 /usr/include/libxml2

  如图:

       

5-[UIDevice uniqueGlobalDeviceIdentifier]: unrecognized selector sent to instance 0x6c29000

-[UIDevice uniqueGlobalDeviceIdentifier]: unrecognized selector sent to instance 0x6c29000

 BaiduMapDemo[716:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDevice uniqueGlobalDeviceIdentifier]: unrecognized selector sent to instance 0x6c29000'

*** First throw call stack:
(0x15c1022 0x1b79cd6 0x15c2cbd 0x1527ed0 0x1527cb2 0xa747d 0x5fa4a 0x12508 0xee4b 0xefda 0x10b34 0x29c0 0x443386 0x444274 0x453183 0x453c38 0x447634 0x23f9ef5 0x1595195 0x14f9ff2 0x14f88da 0x14f7d84 0x14f7c9b 0x443c65 0x445626 0x28e8 0x2845)

terminate called throwing an exception(gdb) 

解决办法:

1)运行报  [UIDevice uniqueGlobalDeviceIdentifier]: unrecognized selector sent to此时需要 other linker  flags 添加 -all_load参数。
         具体:Project ->build settings ->linking->Other Linker flags

2)请检查有没有添加QuartzCore.framework 和 CoreLocation.framework 可能因为缺少这两个框架中的某一个框架造成的错误。

3BMKMapManager 强烈建议通过单例模式管理起来,并且不要手动调用其release方法。

4)进行用户位置定位时除了要设置showsUserLocation = YES,还要在mapView:didUpdateUserLocation:方法中调用setCenterCoordinate:animated
         另外一定要在dealloc中,或者其他离开页面的地方调用showsUserLocation= NO,否则会出现第二次push到定位页面时,不会重新定位问题。
5)必须至少让一个类保持.mm文件,或者按照官方修改编译器类型。

6Undefined symbols for architecture i386 错误

Undefined symbols for architecture i386:

  "_OBJC_CLASS_$_CLLocationManager", referenced from:

      objc-class-ref in HotelQueryViewController.o

ld: symbol(s) not found for architecture i386

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


这是今天弄百度地图api发现的错误,出现这个错误就是在项目中缺少框架

只要导入一个框架即可----CoreLocation.framework

7、iOS调试问题集锦

1、使用instruments调试性能时,报错target failed to run:remote exception encountered:failed to get pid xxx解决方法:把release的证书调成development时的证书,Xcode4使用profile功能时,会自动切换到release模式。

可参考:http://stackoverflow.com/questions/2661399/instruments-target-failed-to-run

2、使用iOS 5.0编译deployment,如果设置低于iPhone3.0时,会提示,warning:iPhone apps with a deployment target lower than 4.3 should include an armv6 architecture(current IPHONEOS_DEPLOYMENT_TARGET = "4.0",ARCHS = "armv7").

解决方法:architecture设置那里,手动添加armv6,确定即可。

可参考:http://www.cnblogs.com/lovecode/articles/2263592.html

          http://fayxjc.blog.163.com/blog/static/366502152011107112910857/

3、Error launching remote program: failed to get the task for process XXX 如何处理

解决方法:看debug/distribution选项是否正确,看证书是否选择正确。

4、Mac OS 10.7.3使用Application loader提交程序验证失败

解决方法:http://artori.us/mac-os-10-7-3-breaks-xcode-binary-validation/?comments=true

8xcode 编译问题

xcode错误调试编译问题

1. invalid deployment target for -stdlib=libc++ (requires iOS 5.0 or later)解决办法:

这个是由于文件编译不支持

可以将target-> Apple LLVM complier 4.1-Language ->C++ standard Library 改成Compiler Default.

2.Undefined symbols for architecture armv

解决办法:看下是否是没有添加libz.1.2.5.dylib的静态库。

3. does not contain a(n) armv7s slice

这个是由于引入外部static lib时候报错,由于xcode升级成4.5后,编译结构有armv7armv7s,如果这个时候编译会告知编译有问题,不支持armv7s,修改的方式如下:

Got the same problem since updating XCode. To work around it, in the XCode project, change the Architecture from "$(ARCHS_STANDARD_32_BIT)" to armv7. "$(ARCHS_STANDARD_32_BIT)" expands to something like armv7, armv7s and the current unity editor doesn't seem to export the correct symbols for armv7s.

4.Undefined symbols for architecture 错误解决 

这个错误是由于资源无法编译通过报出的。一般是从另外一个项目直接复制到新项目导致新项目无法编译出现的问题。
解决办法如下

· Go to the Target in the navigator menu

· Click on the "Build Phases" tab

· Add the .m file to "Compile Sources" (either drag it across, or use the + button)

· Add the .xib to "Copy bundle resources"

· Clean and build

5.解决自动生成Connection时发生的xcode could not insert new xxx for的问题

 

场景是在storyboard下自动将组件拖入头文件代码中,生成自动连接模版,但是有时候会报错。

解决办法如下:

· Close your project.

· Go to the ~/Library/Developer/XCode/DerivedData folder and REMOVE all subfolders there referencing the project you are working on.

· Open your project in XCode. The problem should be fixed now.

9Command/Develeoper/Platforms/iphoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed

Command/Develeoper/Platforms/iphoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
原因如下:

1)查看是不是文件互相引用,比如a中有improt bh b中又有#improt ah

2)重复定义了两个相同的文件,就是整个工程中有两个ah

3)引入文件的时候误把  类名。当成  类名。

解决办法:(其他)

在终端里输入:
sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate /usr/bin

并回车,则可解决

10

XCode编译iphone时出现的问题:The identity 'iPhone Developer' doesn't match any valid certificate/private key

解决办法:

      点击项目名称---Build Settings---All Combined ---Code Signing ---Code Signing Entitlements ---Code Signing Identity ---Debug ---Any IOS SDK 设置为:Don't Code Sign 即可。

原创粉丝点击