Facebook iso sdk increases the app size - ios

I've integrated the latest iOS facebook SDK (v3.10). I did drag and drop the FacebookSDK.framework into my project and unselect the Copy; now the .ipa file size has increased around 8MB. (ipa with FBSDK = 9.9MB -- without FBSDK = 1.5MB)
I tried their sample code, and did the same thing!! But there is no significant changes on the final ipa file!
What would be the possible issue?

There is no issue. The Facebook iOS framework is just that big. It's big because it's a FAT binary including armv7, armv7s, arm64, i386 and x86_64 architectures.
~ $ lipo -i ./FacebookSDK.framework/Versions/A/FacebookSDK
Architectures in the fat file: ./FacebookSDK.framework/Versions/A/FacebookSDK are:
i386 armv7 armv7s x86_64 arm64
It also contains 1.1MB of images, but the majority of the size is the FAT binary.
You can probably modify the Xcode project to make it not build for the Simulator (x86_64 and i386). But your app probably runs on 4S+, so you'll need to keep armv7, armv7s and arm64.
Unselecting the copy doesn't change much (except maybe the images bundle won't be added to your resources, so no images will show, you don't want that). The file size still increases because your app links the Facebook SDK binary in with its own binary (that's how it is able to use the Facebook code from the SDK).

Related

Missing required architecture arm64

I have been running my app fine on a ipad mini throughout development but tried testing it on an iPad air 2 today and it wont run. I get the following warning
ignoring file /ProjectFolder/SwiftEverlive/EverliveSDK.framework/EverliveSDK, missing required architecture arm64 in file /ProjectFolder/SwiftEverlive/EverliveSDK.framework/EverliveSDK (2 slices)
my architectures settigs in my project
It also doesn’t run on the simulator. I also tried opening the project in the Swift everlive folder but that won't open. It says its missing the project.pbxproj file
To be honest did not understand the other answers for similar questions here. Sorry very new to iOS dev.
Edit
The problem seems to be in the settings of the Telerik Everlive Framework and how that was complied is sthere any way i cam fixthis as i dont have time for them to suggest a solution.
I am guessing this means that you are trying to use a framework, namely EverliveSDK, that has not been compiled for a the new 64 bit arm processor in the iPad Air 2. Framework files come with a lot of precompiled code - sometimes intended to be proprietary - and if it hasn't been compiled for your target architecture then you cannot use that framework on that architecture.
The devices that use the arm64 architecture are iPhone 5s and newer. The simulator uses the architectures i386 or i86. If you have the framework available to you (it should look like a little white lego) it should contain a text file of the same name. This text file will appear to contain a bunch of gibberish, however, if you run the command 'lipo -info' on this file in the terminal, if will tell you which architectures the framework contains. I suspect you will be missing arm64, in which case you can't use the framework on the aforementioned devices.
The follow solved the problem:
1. You can try to add arm64 to the Build Settings -> Architectures ->
Excluded Architectures for Any iOS Simulator SDK. It helps many of
devs, but for me it didn't work.
2. You can Clean Build Folder (⇧ + ⌘ +
K), clean DerivedData directory, CocoaPods caches, and restart
macOS, Xcode and Simulator. This solution works for me.
Try this
Remove all valid architecture. It just only set armv7 and armv7s.
Just change Build Settings -> Architectures -> Build Active Architecture Only -> Debug -> NO.

Fat binary validation - (Cocoa [Touch Framework] / [Static Library (converted to framework)]

.
Hello, all.
I noticed some strange thing.
As all you know there are a lot of complaints regarding "unsupported architecture" error message during validation against App Store when using 3rd party frameworks with i386 slice (for example).
I've upgraded xCode to 6.2 and now I have following situation:
I built some simple Single-View application (iPhone) that's using two external custom frameworks (that I built too).
One of the frameworks is 'Cocoa Touch Static Library" that was converted to the framework (using custom script) with two '.a' files (iphoneos and iphonesimulator configurations) combined into one fat binary (using lipo).
The second framework is "Cocoa Touch Framework" (actually, its static version - via Mach-O build settings), with two binary frameworks combined to one fat binary (using lipo too).
When I check both contained-in-framework binaries with "lipo -info" I get - "armv7 i386 x86_64 arm64" in case of first framework and "i386 x86_64 armv7 armv7s arm64" in case of the second one (second framework was built intentionally (manually) with these architectures).
When I archive my app and try to validate it from Organizer - it passes successfully.
When I check the application binary (from the xCode archive folder) with "lipo -info" I get "armv7 arm64" - so now it's clear why no error message is displayed during app validation.
Have any of you seen such behavior?
May Apple fix this issue in xCode 6.2?
I'm going to test it tomorrow with old xCode version (6.1.1) anyway.
Any input is more than welcomed.
Thank you.

Linking to Google APIs Objective-C Client Library as iOS static library

I have so far used Google APIs Client Library for Objective-C by compiling the source files directly into my app (as described here). If I were to switch over to linking to the iOS static library (as also described here), how would this insure that the code works on different architectures?
For instance, if I follow the verbatim instruction I have to compile the static library by choosing a schema (GTLTouchStaticLib) and an architecture (e.g. iOS Simulator: iPhone 5). If I choose a simulator as architecture, file libGTLTouchStaticLib.a reports that the archive contains code for architectures i386 and x86_64. If I choose a physical iPhone 5 instead, file reports on architectures armv7 and arm64.
How do I ensure that the libGTLTouchStaticLib.a that I'm going to drag into my application project's Build Phases "Link Binary with Libraries" list (according to Google's instructions) contains all (not just some) of the architectures that might be encountered when my app goes life? I guess armv7 and arm64 is sufficient for an app that requires iOS 8, but I'd like to be sure.)
You have to combine the generated binaries using lipo command line tool.
The following tutorial about creating static library in iOS demonstrates use of lipo under section Universal Binaries

using lipo vs "valid architecture" while creating universal static library

I want to create a universal static library, say called sampleStaticLib.a, which gets included in an app called HelloWorld. The HelloWorld app needs to use the APIs defined in the static library, and needs to work on both iOS simulator and iOS device. I understand from various posts in the Internet that I can accomplish this by using the lipo tool to aggregate the static libraries of both the simulator and device into a universal library, and then include the universal library inside the HelloWorld.xcodeproj.
However, alternatively, if I do the following:
simply set the valid architecture in the static library xcodeproject
(sampleStaticLib.xcodeproj) to "armv7 armv7s arm64 i386 x86_64
generate the sampleStaticLibrary.a
include it in the HelloWorld.xcodeproj
My expectation is that, since I set the valid architecture of 'sampleStaticLib' to all architectures spanning x86 and ARM, the library should work on both simulator and device. But it doesn't work on the simulator.
So, can't setting a broad "valid architecture" replace the need to use 'lipo tool' while creating universal static libraries?
No, unfortunately, that is not possible as trivially as you would like.
The reason is that when you build your project, it will build with the selected SDK for all of the requested architectures. The iOS SDK supports ARM, and the iOS Simulator SDK supports Intel. You need to build the ARM slices against the iOS SDK and the Intel slices against the iOS Simulator SDK and then lipo them together into a universal binary.
It should work. For instance, this static library
https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/blob/v3/png/prebuilt/ios/libpng.a
It has armv7, armv7s, arm64, i386 and x86_64 binaries.
$ file libpng.a
libpng.a: Mach-O universal binary with 5 architectures
libpng.a (for architecture armv7): current ar archive random library
libpng.a (for architecture armv7s): current ar archive random library
libpng.a (for architecture i386): current ar archive random library
libpng.a (for architecture x86_64): current ar archive random library
libpng.a (for architecture cputype (16777228) cpusubtype (0)): current ar archive random library <-- It's arm64
Xcode(Clang toolchain) can link this static library for iOS device and also iOS simulator. And no problems at all.
But it doesn't work on the simulator.
What do you mean? I recommend you to update the question about it more detail.

After updating Xcode I have issues linking libraries. ARCHS_STANDARD_32_BIT and ARMV7S

After updating the Xcode, my iPad app doesn't compile.
It has a library called Flurry and the compiler says:
"ld: file is universal but doesnt caontain armv7s slice...libFlurry.a"
So, it seems to me Flurry has not been compiled including the armv7s (or iPhone 5) architecture.
Hoever, my app it's only for iPad (iPad 1, 2 and 3)
As far as I know, the armv7s belongs to the iPhone 5 architecture, but none of the current iPads have that architecture.
Am I right?
Does it mean I can change "$(ARCHS_STANDARD_32_BIT)" by "armv7"?
I did it and now the program works perfectly on my iPad, but not sure if this is right, because perhaps the not all iPads are armv7.
Is there any constant for only iPads architectures?
yes, because flurry lib was compiled for armv7 only so flurry lib will not support to armv7s.
So making code work with armv7s, you need to update flurry lib.
But if you just want to run app in armv7 then remove armv7s from build setting.
thanks

Resources