Xcode with Facebook and iOS working - Step By Step
After much frustration I got my Iphone game building just fine. Following a combination of Ixgee’s solution, and other solutions.
Fixes - FBSDKCoreKit.h not found and other related issues
- I’m using Unity and Facebook SDK v11
-
Unity → ExternalDependencyManager → IOS Resolver Settings - make it build to a Xcode project and make sure all the checkboxes are checked.
-
MacOS → move project to Mac. In Terminal in the project directory do the ‘sudo chmod +x process_symbols.sh’
2.5 Make sure you have cocoa pods installed. In Terminal type ‘sudo gem install cocoapods’
- MacOS->Podfile - the pod file in your project should look like this for Facebook SDK 11
source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
target 'UnityFramework' do
pod 'FBSDKCoreKit', '~> 11.1.0', :modular_headers => true
pod 'FBSDKCoreKit_Basics', '~> 11.1.0'
pod 'FBSDKGamingServicesKit', '~> 11.1.0'
pod 'FBSDKLoginKit', '~> 11.1.0'
pod 'FBSDKShareKit', '~> 11.1.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static
use_frameworks!
- [Only needs to be done once. If your Mac processor uses an ARM processor (like the M1)]] Terminal → Type ‘sudo arch -x86_64 gem install ffi’
Solution from - pod install has bug · Issue #10723 · CocoaPods/CocoaPods · GitHub [super helpful!]
- [If your Mac processor uses an ARM processor (like the M1)] Terminal → ‘arch -x86_64 pod install’
Or
[If your Mac processor uses an x86 processor (like an Intel)] Terminal → ‘pod install’
-
Once the Pod Install is successful, double click the newly created ‘Unity-iPhone.xcworkspace’ in your project directory to open the workspace in Xcode.
-
Xcode->The folder option → Unity-IPhone-> under Projects select ‘UnityFramework’-> select ‘Build Phases’ then drag the ‘> Headers’ above the ‘> Compile Sources’
-Full details here ( Xcode Version 13.3 (13E113) error - Cycle in dependencies )
- Xcode → In the Unity-phone - Build Settings → Set - ALWAYS EMBED SWIFT STANDARD LIBRARIES: YES
In the UnityFramework - Build Settings → Set - ALWAYS EMBED SWIFT STANDARD LIBRARIES: NO
Source - ios - Validation Error: Invalid Bundle. The bundle at ... contains disallowed file 'Frameworks' - Stack Overflow
- VOILA! It builds to your iPhone with Facebook SDK Dependencies good to go on iOS!!!
Gillissie’s Similar steps -
From - Facebook SDK build issue with FBSDKCoreKit
Update: After some fussing around, I was able to make this work. I had to do things that I’ve never had to do in the past, so I’m not sure why it’s so different now.
-
Make sure you have cocoapods installed. At the terminal, type “sudo gem install cocoapods”
-
Build for iOS from Unity, which creates a Unity-iPhone.xcodeproj project file and a podfile.
-
Open podfile in a text editor, and add use_frameworks! on a line right after “target”. My podfile ended up looking like this:
target 'Unity-iPhone' do
use_frameworks!
pod 'FBSDKCoreKit', '~> 6.2'
pod 'FBSDKGamingServicesKit', '~> 6.2'
pod 'FBSDKLoginKit', '~> 6.2'
pod 'FBSDKShareKit', '~> 6.2'
end
-
Open terminal at the path of the xcodeproj and podfile files.
-
In terminal, type “pod install”. This will create a Unity-iPhone.xcworkspace file.
-
Open the workspace by double-clicking it.
-
Set all the Unity-iPhone target settings you need in the Unity-iPhone project that’s in that workspace (such as adding frameworks, etc)
-
Choose a device, and build.
Notes: Without the “use_frameworks!” added to the podfile, the xcworkspace will not let you see all of the Unity-iPhone project targets and schemes. I don’t understand the technical stuff about that, but that’s what I discovered.