missing required architecture i386 in file

问题描述:今天研究QCAR的iPhone版本,下载Demo后编译报错,如下:

ld: warning: ignoring file ../../build/lib/arm/libQCAR.a, missing required architecture i386 in file

Undefined symbols for architecture i386:

"QCAR::deinit()", referenced from:

-[EAGLView onDestroy] in EAGLView.o

"QCAR::onResume()", referenced from:

-[EAGLView onResume] in EAGLView.o

-[EAGLView updateApplicationStatus:] in EAGLView.o

"QCAR::onPause()", referenced from:

-[EAGLView onPause] in EAGLView.o

"QCAR::setHint(unsigned int, int)", referenced from:

-[EAGLView updateApplicationStatus:] in EAGLView.o

"QCAR::onSurfaceCreated()", referenced from:

-[EAGLView initApplication] in EAGLView.o

"QCAR::onSurfaceChanged(int, int)", referenced from:

-[EAGLView initApplication] in EAGLView.o

"QCAR::setInitParameters(int)", referenced from:

-[EAGLView initQCAR] in EAGLView.o

"QCAR::init()", referenced from:

-[EAGLView initQCAR] in EAGLView.o

"QCAR::Tracker::getInstance()", referenced from:

-[EAGLView loadTracker] in EAGLView.o

-[EAGLView startCamera] in EAGLView.o

-[EAGLView stopCamera] in EAGLView.o

"QCAR::CameraDevice::getInstance()", referenced from:

-[EAGLView startCamera] in EAGLView.o

-[EAGLView stopCamera] in EAGLView.o

-[EAGLView configureVideoBackground] in EAGLView.o

-[OverlayView actionSheet:clickedButtonAtIndex:] in OverlayView.o

"QCAR::Tool::getProjectionGL(QCAR::CameraCalibration const&, float, float)", referenced from:

-[EAGLView startCamera] in EAGLView.o

"QCAR::Renderer::getInstance()", referenced from:

-[EAGLView configureVideoBackground] in EAGLView.o

-[EAGLView renderFrameQCAR] in EAGLView.o

"QCAR::requiresAlpha()", referenced from:

-[EAGLView initRendering] in EAGLView.o

"QCAR::State::~State()", referenced from:

-[EAGLView renderFrameQCAR] in EAGLView.o

"QCAR::State::getNumActiveTrackables() const", referenced from:

-[EAGLView renderFrameQCAR] in EAGLView.o

"QCAR::State::getActiveTrackable(int) const", referenced from:

-[EAGLView renderFrameQCAR] in EAGLView.o

"QCAR::Tool::convertPose2GLMatrix(QCAR::Matrix34F const&)", referenced from:

-[EAGLView renderFrameQCAR] in EAGLView.o

ld: symbol(s) not found for architecture i386

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

问题分析:开始以为是没有找到库,重新引用库,无效。后查Google,要删除掉Targets-Build Settings-Library Search Paths,照做,无效。最后找到以下这段:

It seems the library is built for phone deployment (ARM) but you are trying to link it to a simulator executable (x86). This won't work. Rebuild the library for the simulator.

问题解决:切换成Device编译,搞定。

升级后iOS后上传审核Architectures问题

问题描述:今天Geely的iPhone版本要上架,用Application Loader上传报错,如下:

iPhone/iPod Touch: application executable is missing a required architecture. At least one of the following architecture(s) must be present: armv6

问题分析:显然问题出在升级iOS5后的配置问题上。

问题解决:在Target的Build Settings里,找到Architectures,点击"Standard(armv7)",再点"Other...",把原来的内容删掉,在分两行输入"armv6"和"armv7",搞定。

iOS5结构体编译严格

问题描述:今天二罗升级iOS SDK5,发现Monster不能编译了。具体报错信息如下:

variable length array of non-POD element type 'b2Vec2'

问题分析:错误指向的是cocos2d里一个结构体数组定义,如下:

b2Vec2 vertices[vertexCount];

问题解决:把其改成指针形式,如下:

b2Vec2 *vertices = new b2Vec2[vertexCount];

搞定了。

iOS SDK5升级类库问题

问题描述:今天小新升级iOS SDK5,发现Stupid不能编译了。具体报错信息如下:

Ld /Users/terrence/Library/Developer/Xcode/DerivedData/FSStupid-btpugnuitaisoebkwchzpplpvjuq/Build/Products/Debug-iphonesimulator/FSStupid.app/FSStupid normal i386
    cd "/Users/terrence/Desktop/FSStupid 10.14 2"
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/terrence/Library/Developer/Xcode/DerivedData/FSStupid-btpugnuitaisoebkwchzpplpvjuq/Build/Products/Debug-iphonesimulator "-L/Users/terrence/Desktop/FSStupid 10.14 2/FSStupid/WeiboEngine" "-L/Users/terrence/Desktop/FSStupid 10.14 2/FSStupid/WeiboEngine/Libraries & Headers" "-L/Users/terrence/Desktop/FSStupid 10.14 2/FSStupid/WeiboEngine/WeiboEngine" -F/Users/terrence/Library/Developer/Xcode/DerivedData/FSStupid-btpugnuitaisoebkwchzpplpvjuq/Build/Products/Debug-iphonesimulator -filelist /Users/terrence/Library/Developer/Xcode/DerivedData/FSStupid-btpugnuitaisoebkwchzpplpvjuq/Build/Intermediates/FSStupid.build/Debug-iphonesimulator/FSStupid.build/Objects-normal/i386/FSStupid.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=30100 -framework CoreAudio -framework AudioToolbox -framework StoreKit -lz.1.2.3 -framework MessageUI -lsqlite3 -licucore -framework SystemConfiguration -framework MobileCoreServices -framework Security -framework CFNetwork -framework MediaPlayer -framework AVFoundation -framework UIKit -framework Foundation -framework CoreGraphics -lOAuth -o /Users/terrence/Library/Developer/Xcode/DerivedData/FSStupid-btpugnuitaisoebkwchzpplpvjuq/Build/Products/Debug-iphonesimulator/FSStupid.app/FSStupid

ld: library not found for -lz.1.2.3
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1

问题分析:看来是找不到类库的问题,lz.1.2.3对应的是libz.1.2.3.dylib。而/Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest/Symbols/usr/lib目录下只有libz.1.2.5.dylib。

问题解决:在project设置里重新引到新版本的类库,一切ok了。

UIButton无法改变大小尺寸

问题描述:Touch Team做Stupid。发现4.0以上按钮尺寸正常,而4.0以下按钮会大一倍。按钮点击等都很正常。

问题分析:UIButton的frame和bonus都不能改变其尺寸。尺寸一直是图片的原始大小。因为4.0以下一般都不是高清屏,所以要对原始图片缩小尺寸。

问题解决:仔细检查代码后,[UIButton setImage: forState:]改为[UIButton setBackgroundImage: forState:],一切ok了。

[UIWindow setRootViewController:]需要4.0以上支持

问题描述:今天Touch Team出Stupid测试版,安装20多台iPhone、iTouch、iPad,都可以安装。但是有一台iPhone(3.1.2)报错,不能安装。注:其他设备基本都在4.0以上。

问题分析:因为是调试安装,所以能看到报错信息,如下:

GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:56:02 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin --target=arm-apple-darwin".tty /dev/ttys000
target remote-mobile /tmp/.XcodeGDBRemote-16799-38
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
[Switching to process 11779 thread 0x0]
[Switching to process 11779 thread 0x0]
sharedlibrary apply-load-rules all
warning: Unable to read symbols for /Library/MobileSubstrate/MobileSubstrate.dylib (file not found).
warning: Unable to read symbols for /Library/Frameworks/CydiaSubstrate.framework/Libraries/SubstrateLoader.dylib (file not found).
2011-09-27 17:40:14.990 FSStupid[2874:207] MS:Notice: Installing: com.flipscript.stupid [FSStupid] (478.52)
2011-09-27 17:40:15.368 FSStupid[2874:207] MS:Notice: Loading: /Library/MobileSubstrate/DynamicLibraries/Backgrounder.dylib
warning: Unable to read symbols for /Library/MobileSubstrate/DynamicLibraries/Backgrounder.dylib (file not found).
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.1.3/Symbols/usr/lib/libsubstrate.dylib (file not found).
2011-09-27 17:40:17.131 FSStupid[2874:207] MS:Notice: Loading: /Library/MobileSubstrate/DynamicLibraries/Multitasking.dylib
warning: Unable to read symbols for /Library/MobileSubstrate/DynamicLibraries/Multitasking.dylib (file not found).
2011-09-27 17:40:18.007 FSStupid[2874:207] *** -[UIWindow setRootViewController:]: unrecognized selector sent to instance 0x23fe20
2011-09-27 17:40:18.016 FSStupid[2874:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIWindow setRootViewController:]: unrecognized selector sent to instance 0x23fe20'
2011-09-27 17:40:18.034 FSStupid[2874:207] Stack: (
843263261,
825818644,
843267069,
842763033,
842725440,
11685,
843742792,
843741800,
844074496,
844072508,
844071060,
860907492,
843011371,
843009055,
843738120,
843731504,
11481,
11404
)
terminate called after throwing an instance of 'NSException'
(gdb)

 

报错的语句是:

self.window.rootViewController = startViewController;

仔细查看报错信息,发现这句报错:-[UIWindow setRootViewController:]: unrecognized selector sent to instance。查看setRootViewController方法,发现需要4.0以上支持。

解决方案:把出错代码:

self.window.rootViewController = startViewController;

替换为:

if( [[[UIDevice currentDevice] systemVersion] compare:@"4.0" options:NSNumericSearch] == NSOrderedAscending )
[self.window addSubview:self.mainViewController.view];
else self.window.rootViewController = self.mainViewController;

一切ok了。

后台运行App导致无法调试

问题描述:Touch Team做Stupid,调试的时候console报以下问题:
warning: Unable to read symbols for /Library/MobileSubstrate/MobileSubstrate.dylib (file not found). warning: Unable to read symbols for /Library/Frameworks/CydiaSubstrate.framework/Libraries/SubstrateLoader.dylib (file not found). 2011-09-21 12:46:54.465 FSStupid[18953:607] MS:Notice: Installing: com.flipscript.stupid [FSStupid] (550.58) 2011-09-21 12:46:54.489 FSStupid[18953:607] MS:Notice: Loading: /Library/MobileSubstrate/DynamicLibraries/Activator.dylib warning: Unable to read symbols for /Library/MobileSubstrate/DynamicLibraries/Activator.dylib (file not found). 2011-09-21 12:46:54.752 FSStupid[18953:607] MS:Notice: Loading: /Library/MobileSubstrate/DynamicLibraries/QQInput.dylib warning: Unable to read symbols for /Library/MobileSubstrate/DynamicLibraries/QQInput.dylib (file not found). warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J3)/Symbols/usr/lib/libsubstrate.dylib (file not found). 2011-09-21 12:46:54.889 FSStupid[18953:607] MS:Notice: Loading: /Library/MobileSubstrate/DynamicLibraries/libstatusbar.dylib warning: Unable to read symbols for /Library/MobileSubstrate/DynamicLibraries/libstatusbar.dylib (file not found).

问题分析:用其他的几台设备测试,一切正常。用有问题的那台机器,然后直接运行,也一切正常。网上查了下,是一些后台运行的程序可能搞鬼(如报错信息中的:QQInput.dylib、libstatusbar.dylib等)

问题解决:用Cydia删除一些dylib,就没有问题了。