How do I build an app and framework on OS X 10.6 that can run on 10.5? - objective-c

Here's my situation: I have the source code for a third-party framework that I want to include in my project. I'm developing on 10.6 but I want to support 10.5, so I have the base SDK and the deployment target set to 10.5.
I can build the framework and the application, and the app runs inside Xcode and on the machine. However, it fails on a 10.5.8 and crashes. The crash report says
Unknown required load command 0x80000022
I have also tried building the framework on the 10.5.8 machine, setting the architecture to '32/64-bit Universal'. Moving this framework to the 10.6 machine and attempting to build the app works, but the app fails to run, throwing multiple errors of:
-[NSCFArray matchAndAssemble:]: unrecognized selector sent to instance 0x3503c0
Has anyone seen this before? Do you know of a fix or workaround? It can't be an uncommon situation.

The loader command being flagged is the loader command for a compressed binary which is a binary type supported only on 10.6.
matchAndAssemble: is not a (documented) method of NSArray/NSMutableArray. It is, however, a method of the PKParser kit. Is that the framework you are trying to build?
Anyhow, something in your project is being built only for 10.6 and it's probably that framework. Check the build settings for all of your targets, and any targets of any sub projects and do an otool -l on any third party frameworks to look for the 22 load command.

Answer for the first error: unable to read unknown load command 0x80000022 - Stack Overflow, and it might have a bearing on the second error. What version Xcode and SDK are you using?

Related

ColorSync framework missing on Sierra when building with Xcode 9

When building our macOS application on Sierra (10.12.6) with Xcode 9 (9A235), the application will not launch properly because of the ColorSync framework -- this can't be located by dyld:
Termination Reason: DYLD, [0x1] Library missing
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
Library not loaded: /System/Library/Frameworks/ColorSync.framework/Versions/A/ColorSync
Referenced from: /Volumes/*/ColorSyncTest.app/Contents/MacOS/ColorSyncTest
Reason: image not found
Given that ColorSync.framework in the 10.13 SDK resides directly at /System/Library/Frameworks, instead of being a child of ApplicationServices.framework as it used to be, the error makes sense...
We've tried linking explicitly (both strongly and weakly) to both ColorSync and ApplicationServices -- to no avail.
The question is -- how are people using ColorSync in Xcode 9 on anything earlier than 10.13?
Any ideas would be very much appreciated.
Thanks,
D.
We've managed to fix the issue by changing the deployment target for the dynamic library which uses ColorSync - from 10.8 to 10.9. I don't know why this works exactly, if someone else does, please share.
The first place to look for answers to these sorts of problems are the Mac OS X Release Notes. You can also check the API Changes page.
It looks like you are building against the 10.13 SDK and running on 10.12, can you change your target [macOS Deployment Target] to 10.12 and see if the linkage clears up?

Can't run xctest on macOS app - couldn’t be loaded because it is damaged or missing necessary resources

Please do help me on this scenario. I saw several post related to this, but could not able to resolve the issue with my mac App without pods.
Project is several years old, developed in macOS(Objective C). Now I am trying with XCTest for unit testing. Using Xcode 7.3.1, I am not able to run tests classes.
This project is to create frame work. Project is working fine, only issue is with the testing. We are not supposed to do Pods or some other alternatives.
Console window shows below points:
xctest[35530:345970] The bundle “BaseLibTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. xctest[35530:345970]dlopen_preflight(/Users/12345678/Documents/Modify/Cocoa/Projects/BaseLib/build/Debug/BaseLibTests.xctest/Contents/MacOS/BaseLibTests): Library not loaded: #executable_path/../Frameworks/FreeTDS.framework/Versions/A/FreeTDS
Referenced from: /Users/12345678/Documents/Modify/Cocoa/Projects/BaseLib/build/Debug/BaseLib.framework/Versions/Current/BaseLib
Reason: no suitable image found. Did find:
/Library/Frameworks/FreeTDS.framework/Versions/A/FreeTDS: no matching architecture in universal wrapper)
Program ended with exit code: 82
#Anand For the 3rd Point: Please check the build settings.
Please make sure its either set to Standard Architectures (64-bit Intel) (x86_64) - $(ARCHS_STANDARD) or set to represent proper architectures.
To debug this more, could you please copy paste the exact error you are facing and share the build env variables?

What will happen if a framework get deleted from an app?

I was asked a question, what will happen when a framework is accidentally deleted from your device may be iphone or mac?
Whether your application crash or it will work without any error?
Please provide me answer with explainations.
You may get linking error. If framework folder is inside the application means its runtime linking.
OS X embeds an "install name" inside each dynamic library. This
install name is the path to where the library can be found when dyld
needs to load it. When you build an application that links against a
dynamic library, this install name is copied into the application
binary. When the application runs, the copied install name is then
used to locate the library or framework.
$ otool -D /Applications/Google\ Drive.app/Contents/Frameworks/Python.framework/Versions/2.6/Python
/Applications/Google Drive.app/Contents/Frameworks/Python.framework/Versions/2.6/Python:
#executable_path/../Frameworks/Python.framework/Versions/2.6/Python
so if you will delete Frameworks folder you will get Dyld Error.
Dyld Error Message:
Library not loaded: #loader_path/../Frameworks/Sparkle.framework/Versions/A/Sparkle
Referenced from: /Applications/Transmission.app/Contents/MacOS/Transmission
Reason: image not found
If a framework is deleted, only software linking to that framework would be affected.
If it is a system framework, expect your system to start failing.
If it is a 3rd party framework, it should be limited in scope of impact.
If it is in your app bundle, and your app is code-signed, the removal of the bundled framework should prevent your app from launching.
It depends on if the application needs access to the framework you have removed.
If you application requires the framework then it will not compile.
If you dont need it, it will just compile like normal.

RestKit.h Not Found When Building With Xcode Product > Profile

I have an app that uses RestKit 0.10.2 and I can build and run the app just fine in the Xcode 4.4.1 simulator using iOS 5.1.1. I can also run Analyze without any issues. However, when I go to try and Profile the app, the build fails with Lexical or Preprocessor Issue RestKit/Reskit.h file not found.
Here's what I have in Header Search Paths > Debug on the target:
$(BUILT_PRODUCTS_DIR)/../three20
$(BUILT_PRODUCTS_DIR)/../../three20
"$(BUILT_PRODUCTS_DIR)/../../Headers"
What could I be missing? When I upgraded from 0.94 to 0.10.2 I completely removed Restkit from my project and re-imported it because I was having a lot of issues trying to get this exact same problem resolved for a normal run. Any ideas?
Profile uses a Release build by default, not Debug (since it makes no sense to profile a debug build). Make sure Header Search Path -> Release is also filled in.

How can I fix a missing mscorelib.dll error that occurs when trying to run a Mono for Android app?

In MonoDevelop when compiling and running an app developed for Android against the simulator, the app compiles then crashes immediately in the simulator with the following application output...
E/mono ( 225): The assembly mscorlib.dll was not found or could not be loaded.
E/mono ( 225): It should have been installed in the `/home/jon/Development/xamarin/mono/BUILD/armeabi/install/lib/mono/2.0/mscorlib.dll' directory.
Keep in mind that I'm not Jon so I don't even know where it's getting the /home/jon path configuration. Though I have found that path in other similar but ultimately unrelated searches on the internet so I imagine it's a path on some other devs machine.
mscorlib.dll is indeed on my machine. located here...
/Developer/MonoTouch/usr/lib/mono/2.1/
and here...
/Developer/MonoAndroid/usr/lib/mono/2.1/
I've tried targetting various Android SDK environments (currently 2.3 and the simulator is currently running under the 2.3 SDK environment as well).
I'm on Mac OSx 10.7.2. Using the latest version of MonoDevelop, Mono and Mono for Android. I've also got the latest MonoTouch installed as well and iPhone apps compile fine if that's worth anything.
The closest thing I can find to a hint at the issue is here...
http://phonicuk.com/Forums/ViewThread.aspx?tid=401
I've tried reinstalling Mono and Mono for Android but admittedly have not tried uninstalling in entirely before a reinstall. I've searched within files for the /home/jon path thinking that it must be a configuration somewhere but haven't been able to find it anywhere.
I found this... Mono return error: mono mscorlib.dll was not found
Along with a few other things that were sort of in the same vein, but ultimately nothing that seems to be a fix.
Any ideas?
Update: From the suggestions in jonp's answer below it indeed seems like the Mono.Android.DebugRuntime package is not installed. So far I've tried a couple of MonoAndroid reinstalls and have tried removing MonoAndroid entirely beforehand. I'm trying to figure out if there is a way to add the package manually, but I'm so new to this.
Another update: Not sure why I didn't try this already, but I created a HelloWorld MonoAndroid app and it works fine. The compilation took a while longer too for that one and I could see if was setting up the required packages, so there has to be an issue with the specific solution.
When you install a Debug build of your app on the device, three .apk files are installed:
Mono.Android.DebugRuntime, which contains libmonosgen-2.0.so, mscorlib.dll, etc.
Mono.Android.Plaltform.ApiLevel_N, which contains Mono.Android.dll for API level N.
Your application.
My guess is that the Mono.Android.DebugRuntime package has not been installed. To check this, run:
adb shell pm list packages | grep Mono.Android
I'm going to guess that it's missing. :-)
Next, why is it missing? When you Run the app within MonoDevelop, all required packages are checked for and installed. It seems rather odd that it wouldn't be. Is your device low on disk space?
adb shell df /data
How are you launching the emulator? If you're launching within MonoDevelop, there should be enough free space to install all of the above packages. However, if you launch it yourself, the default /data size is 64MB, which isn't enough to support a Debug build environment. Please launch the simulator from MonoDevelop and re-Run your app, or launch the emulator so that it has enough free space:
emulator -partition-size 512 -avd YOUR_AVD_NAME