What Is MACh-O Type Should I Use It in My iOS Objective-C Project

In Xcode project target build settings, What is Mach-O Type?

Mach-O, short for Mach object file format, is a file format for executables, object code, shared libraries, dynamically-loaded code, and core dumps. For unix users this is like a.out but with improvements. This is the format used in Mac OS X and iPhone OS libraries for executable files.

As you know iOS devices (iPhone, iPad etc.) have different architectures ARMv6 (iPhone 2G + 3G, iPod Touch) and ARMv7 (iPhone 3GS, iPod Touch 2G + 3G) but the simulators used in Xcode runs mostly on i386 platform. This means the that the library clients have to setup separate targets for the simulator and device. The separate targets duplicate most information, and only differ in the static libraries included. So if you are getting a Mach-O linker error what it means is that xcode is having trouble linking to one of the libraries for that target device; as a result of which compilation fails.

Now your definitions -

  1. Executable - compiled machine targeted program ready to be run in binary format.
  2. Dynamic Library - are linked during runtime -- a program with references to a dynamic library will load and link with the library when it starts up (or on demand).
  3. Bundles - and bundle identifier let iOS and OSX recognise any updates to your app. It gives it a unique presence in the app.
  4. Static Library - files are linked at build time. code is copied into the executable. Code in the library that isn't referenced by your program is removed. A program with only static libraries doesn't have any dependencies during runtime.
  5. Relocatable Object File - is another word for a dynamic library. When you link with a dynamic library, the addresses of the functions contained within are computed, based on where the library is loaded in memory. They are "relocatable" because the addresses of the contained functions are not determined at link time. (In a static library, the addresses are computed during link time.)

What is Mach-O type should I use it in my iOS Objective-C project?

Sample Image

For more detail Building Mach-O Files
and Xcode Build Setting Reference

Can iPhone app using custom framework with Mach-O object be rejected?

As long as it is native and objective-c you shouldn't have any problems. Though I did find this:

http://blog.cascadesoft.net/2010/09/10/new-app-store-rules-and-the-objective-c-versus-3rd-party-framework-question-for-iphone-apps/

Apple Mach-O Linker Error with third party SDK

I just had the exact same problem trying to setup a new CafeX project. I followed the documentation exactly and was faced with 87 linker errors when I tried to build. I fixed this by adding libstdc++.6.dylib which I noticed was in there sample app but not mentioned in the docs.

Xcode gives Apple Mach-O linker error

Teaching a man (or women) how to fish:

Usually Mach-O Linker Error means you have not included a header file for a function you are using in your code.

Easiest way is to copy that function or method call and paste into Xcode quick search using shift+command+O. This will search all frameworks (and header files), find that function or method call and show you its location (the header in this case):

In this case, this call belongs to the Accelerate framework so on top of your file, enter:

#import <Accelerate/Accelerate.h>

When doing quick search, you might have to get rid of leading underscore. In other words, search for vImageBoxConvolve_ARGB8888

Hope this helps

Apple Mach-O-Linker Error CocoaPods

This error usually occurs either when you don't have the correct frameworks (might be missing one) or when you don't have the right thing in linker flags.

Go to the main page for the app (on the navigation thing on the left click on your apps name or the top section) -> Build Settings and under Linker Flags, make sure there is nothing in your Other Linker Flags. I had this same error when I had -ObjC in my other Linker Flags.

You might also want to try adding -lPods to your Other Linker Flags or adding the CoreGraphics framework if you don't already have it.

Good luck

Apple Mach-O Linker Error - ld: file not found: -ObjC

Thanks everyone, I managed to sort it.

@Droppy pointed me in the right direction.

Before the -ObjC flag there was another called -force_all. I then stumbled across this answer which indicated that you only need the -ObjC flag. I removed -force_all and it started to work!



Related Topics



Leave a reply



Submit