Monday, April 29, 2013

NSBundle executableArchitectures example ios


Returns an array of numbers indicating the architecture types supported by the bundle’s executable.
- (NSArray *)executableArchitectures
Return Value of [NSBundle executableArchitectures]
An array of NSNumber objects, each of which contains an integer value corresponding to a supported processor architecture. For a list of common architecture types, see the constants in“Mach-O Architecture.” If the bundle does not contain a Mach-O executable, this method returnsnil.
Discussion of [NSBundle executableArchitectures]
This method scans the bundle’s Mach-O executable and returns all of the architecture types it finds. Because they are taken directly from the executable, the returned values may not always correspond to one of the well-known CPU types defined in “Mach-O Architecture.”
Example of [NSBundle executableArchitectures]
NSArray *targetArch = p[NSBundle bundleWithPath:@"/path/to/bundle.bundle"] executableArchitectures];
NSArray *thisArch = [[NSBundle mainBundle] executableArchitectures];

if ([targetArch firstObjectInCommonWithArray:thisArch])
    // target bundle has architecture which matches current application