How to solve "Library not loaded" error because of LocalAuthentication.framework? - ios7

I can successfully run my app in IOS 8 but in IOS 7, my app crashes.
The message is:
dyld: Library not loaded: /System/Library/Frameworks/LocalAuthentication.framework/LocalAuthentication
Referenced from: /Users/burakkilic/Library/Developer/CoreSimulator/Devices/A0210158-BC6C-43AA-9D85-AA8DE6115AAA/data/Applications/xxx
Reason: no suitable image found. Did find:
/System/Library/Frameworks/LocalAuthentication.framework/LocalAuthentication: mach-o, but wrong architecture
How can I solve it?

You could weak link LocalAuthentication.framework and conditionally access the LocalAuthentication API at runtime.
The latter can be done by either:
Checking the iOS version you are running.
Using reflection to test for the presence of API methods (respondsToSelector, et al).

Related

Native linking failed. Please review the build log in Xamarin.iOS Cross platform

I am trying to rebuild my xamarin.iOS project in release mode and i am getting following Errors:
linker command failed with exit code 1 (use -v to see invocation).
error MT5209: Error: warning: ignoring file /Users/admin/Desktop/1DMAPP/MobileApp/MobileApp/MobileApp.iOS/obj/iPhone/Release/mtouch-cache/BEMCheckBox.framework/BEMCheckBox, missing required architecture armv7s in file /Users/admin/Desktop/1DMAPP/MobileApp/MobileApp/MobileApp.iOS/obj/iPhone/Release/mtouch-cache/BEMCheckBox.framework/BEMCheckBox (4 slices) (MobileApp.iOS) Native linking
/Users/admin/Desktop/1DMAPP/MobileApp/MobileApp/MobileApp.iOS/MTOUCH: Error MT5211: Native linking failed, undefined Objective-C class: BEMCheckBox. The symbol '_OBJC_CLASS_$_BEMCheckBox' could not be found in any of the libraries or frameworks linked with your application. (MT5211) (MobileApp.iOS)
/Users/admin/Desktop/1DMAPP/MobileApp/MobileApp/MobileApp.iOS/MTOUCH: Error MT5211: Native linking failed, undefined Objective-C class: BEMCheckBoxGroup. The symbol '_OBJC_CLASS_$_BEMCheckBoxGroup' could not be found in any of the libraries or frameworks linked with your application. (MT5211) (MobileApp.iOS)
/Users/admin/Desktop/1DMAPP/MobileApp/MobileApp/MobileApp.iOS/MTOUCH: Error MT5202: Native linking failed. Please review the build log. (MT5202) (MobileApp.iOS)
I am using the latest and stable version of packages.
My Link Behavior is "Don't Link"
My project supports all architectures
I want to build and release my iOS app. Native linking error is not allowing me to do this.

Unable to setup Agora Recording SDK

I am trying to setup Agora recording setup, I have complied the samples provided in bundle and trying to run them. I am getting following exception where code is unable to find recording.dll
Exception in thread "main" java.lang.UnsatisfiedLinkError: no recording in
java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at io.agora.recording.RecordingSDK.<clinit>(RecordingSDK.java:24)
This doesn't look like an Agora error rather a Java error. The function is not finding a dependent method in its link path, you can check which function its failing on, and then check if you have a path mismatch in your compilation path
You can do java -XshowSettings:properties -version and then look at the value of java.library.path to see the library paths.

Static Library and -weak-lSystem

I build a static library that links against other frameworks, particularly CoreLocation. I want to use features provided by iOS 5 but be compatible with 4.3.
My app crash at launch when I start it on iOS devices in 4.3 with this error :
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
The problem I encounter is described in this post : iOS 4 app crashes at startup on iOS 3.1.3: Symbol not found: __NSConcreteStackBlock.
But how do you deal with that when building a static library ?? I can't compile when I set the -weak-lSystem flag. Here is a trace :
/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
Resolved
See accepted answer below and do not forget to mark libraries used in different versions as Optional in Xcode. Ex: I use UIKit new notification for iOS 5 but my deployement target is 4.3 so I need to mark this library as Optional in order to make things work. It is the same for CoreLocation CLGeocoder new iOS 5 class.
The problem is that UIKeyboardDidChangeFrameNotification is not available on iOS 4 and therefore the dynamic loader (Dyld) fails.
From the perspective of the static library developer you don't have to do anything. The -weak-lSystem flag should be set in the Xcode project that uses the static library for an application (see the post mentioned in the question) - not in the project for the static library.

At least one of the following architecture(s) must be present: armv7 (-19033) Unable to validate your application. - (null)

I am developing an Ipad only application but i am getting much problem in "Application failed codesign verification due to invalid entitlements" error when i trying to submit on apple store and also some issue which i am mentioning with what i have done below. I am using Xcode 4.3.2 and and IOS 5.1 for development and Target is IOS 5.0
1. iPad: application executable is missing a required architecture. At least one of the following architecture(s) must be present: armv7 (-19033)
for this i did like other people mention
ARCHS = armv7 armv6
i add Architecture armv7 but its not working here is the link of build setting I have no Entitlement file as people told me but if you can help me
2. Application failed codesign verification. The signature was invalid, contains disallowed entitlements, or it was not signed with an iPhone Distribution Certificate. (-19011)
3. Unable to extract entitlements from application: (null) (-19045)
This is the comeplete error, ihope you guy take me futher, thanks
Validate /Users/bourne/Library/Developer/Xcode/DerivedData/TurfNutritionTool_ver_5.1-azcqbuzeebaybzdjeksuhyuvyrmw/Build/Products/Release-iphoneos/TurfNutritionTool_ver_5.1.app
cd /Development/TurfNutritionTool_IOS_5.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv PRODUCT_TYPE com.apple.product-type.application
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation /Users/bourne/Library/Developer/Xcode/DerivedData/TurfNutritionTool_ver_5.1-azcqbuzeebaybzdjeksuhyuvyrmw/Build/Products/Release-iphoneos/TurfNutritionTool_ver_5.1.app
warning: iPad: application executable is missing a required architecture. At least one of the following architecture(s) must be present: armv7 (-19033)
Unable to validate your application. - (null)
warning: Application failed codesign verification. The signature was invalid, contains disallowed entitlements, or it was not signed with an iPhone Distribution Certificate. (-19011)
Executable=/Users/bourne/Library/Developer/Xcode/DerivedData/TurfNutritionTool_ver_5.1-azcqbuzeebaybzdjeksuhyuvyrmw/Build/Products/Release-iphoneos/TurfNutritionTool_ver_5.1.app/Info.plist
codesign_wrapper-0.7.10: using Apple CA for profile evaluation
AssertMacros: exec, file: codesign.c, line: 170
AssertMacros: binary, file: codesign.c, line: 235
AssertMacros: code_signatures, file: codesign_wrapper.c, line: 945
- (null)
warning: Unable to extract entitlements from application: (null) (-19045)
Unable to validate your application. - (null)
Solved this problem by setting Architectures to armv7 only and changing Deployment Target to 4.3 (it was 4.0 before).
I had this problem and fixed it by setting Build Active Architecture Only to No (it is actually a major speed up during development to have it set to Yes!)
Please check the following settings in your apps :
In the Info.plist. Check for "Required device capabilities" info, and look the data inside. You should have 2 items (NSArray) : armv6 and armv7

Can't run Cocoa UnitTests because of Garbage Collector disabling

I'm trying to add some UnitTests to a bunch of Cocoa Legacy code.
I created a Unit Test Bundle, and added all source and frameworks needed, but the build fails with this message:
2010-08-26 16:07:18.074 otest-x86_64[64675:903] The test bundle at
/Users/giordano/application/build/Release/UnitTest.octest
could not be loaded because its Objective-C runtime information does not match
the runtime information required by the test rig. This is likely because the
test rig is being run with Objective-C garbage collection disabled, but the
test bundle requires Objective-C garbage collection. To enable Objective-C
garbage collection for the test rig, run it in an environment without the
OBJC_DISABLE_GC environment variable.
I tried to enable garbage collector, but another error appears:
2010-08-26 16:38:28.824 otest-x86_64[71383:903] The test bundle at
/Users/giordano/work/CleanCode/Pomodori.st/desktop/Osx/pomodoro-
buildfix/pomodoro/build/Release/UnitTest.octest could not be loaded
because an unanticipated error occurred: Error Domain=NSCocoaErrorDomain
Code=3587 UserInfo=0x20002a640 "The bundle “UnitTest.octest” couldn’t be
loaded because it is damaged or missing necessary resources."
(dlopen_preflight(/Users/giordano/application/build/Release/UnitTest.octest/Contents/MacOS/UnitTest): Library not loaded:
#loader_path/../Frameworks/Sparkle.framework/Versions/A/Sparkle
Referenced from:
/Users/giordano/application/build/Release/UnitTest.octest/Contents/MacOS/UnitTest
Reason: no suitable image found. Did find:
/Users/giordano/application/build/Release/UnitTest.octest/Contents/MacOS/../Frameworks/Sparkle.framework/Versions/A/Sparkle:
GC capability mismatch
/Users/giordano/application/build/Release/UnitTest.octest/Contents/MacOS/../Frameworks/Sparkle.framework/Versions/A/Sparkle:
GC capability mismatch)
I wonder if it's possible to force Unit Test to run without Garbage Collection:
Any clue?
The sparkle framework needs to built GC enabled.