Ich baue eine statische Bibliothek, die Links zu anderen Frameworks, insbesondere CoreLocation. Ich möchte die Funktionen von iOS 5 nutzen, bin aber mit 4.3 kompatibel.Statische Bibliothek und -weak-lSystem
Mein app Absturz beim Start, wenn ich es auf iOS-Geräten in 4.3 mit diesem Fehler zu starten:
Date/Time: 2012-08-22 16:44:53.900 +0200
OS Version: iPhone OS 4.3.3 (8J3)
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x00000001, 0xe7ffdefe
Crashed Thread: 0
Dyld Error Message:
Symbol not found: _UIKeyboardDidChangeFrameNotification
Das Problem begegne mir in diesem Beitrag beschrieben: iOS 4 app crashes at startup on iOS 3.1.3: Symbol not found: __NSConcreteStackBlock.
Aber wie gehen Sie damit um, wenn Sie eine statische Bibliothek erstellen? Ich kann nicht kompilieren, wenn ich das Flag -weak-lSystem einstelle. Hier ist eine Spur:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified, -all_load invalid
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified the following flags are invalid: -ObjC
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -weak-lSystem
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -weak-lSystem is not an object file (not allowed in a library)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/libxml2.2.dylib is a dynamic library, not added to the static library
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/libxml2.2.dylib is a dynamic library, not added to the static library
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/libz.dylib is a dynamic library, not added to the static library
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/libz.dylib is a dynamic library, not added to the static library
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1
Gelöst
Siehe akzeptierte Antwort unten und vergessen Sie nicht, Bibliotheken in verschiedenen Versionen als Optional in Xcode verwendet zu markieren. Bsp .: Ich benutze UIKit neue Benachrichtigung für iOS 5, aber mein Implementierungsziel ist 4,3, also muss ich diese Bibliothek als Optional markieren, damit alles funktioniert. Dies gilt auch für die neue Klasse 5 von CoreLocation CLGeocoder.
Ich habe versucht, die dynamischen libs schwach zu verknüpfen, kein Erfolg. Ich habe auch versucht, -dynamic Flag hinzuzufügen, aber es ist sogar am schlimmsten! – nverinaud