Facebook sdk not working if I place the sdk folder inside react-native project? - ios

I am wanting to manually link the Facebook SDK because we don't use cocoapods & don't want to implement it. But for some reason when we build our app on buddybuild, it will fail.
What I've done is placed the FacebookSDK folder inside (not an optimal solution I know):
ios/<ProjectName>/FacebookSDK
I added this folder ($(SRCROOT)/ios/<ProjectName>/FacebookSDK) to the framework search header paths & it still seems to throw errors.
1850
▸ Compiling RCTFBSDKShareDialog.m
1851
» In file included from node_modules/react-native-fbsdk/ios/RCTFBSDK/share/RCTFBSDKShareDialog.m:19:
1852
✗ node_modules/react-native-fbsdk/ios/RCTFBSDK/share/RCTFBSDKShareDialog.h:21:9: fatal error: 'FBSDKShareKit/FBSDKShareKit.h' file not found
1853
» #import <FBSDKShareKit/FBSDKShareKit.h>
1854
» ^
1855
▸ Compiling RCTFBSDKAppEvents.m
1856
» In file included from node_modules/react-native-fbsdk/ios/RCTFBSDK/core/RCTFBSDKAppEvents.m:19:
1857
✗ node_modules/react-native-fbsdk/ios/RCTFBSDK/core/RCTFBSDKAppEvents.h:21:9: fatal error: 'FBSDKCoreKit/FBSDKCoreKit.h' file not found
1858
» #import <FBSDKCoreKit/FBSDKCoreKit.h>
1859
» ^
1860
** BUILD FAILED **
1861
The following build commands failed:
1862
CompileC /tmp/sandbox/582d62aa1d76fc0100f1f6dd/bbbuild/Build/Intermediates/RCTFBSDK.build/Release-iphoneos/RCTFBSDK.build/Objects-normal/armv7/RCTFBSDKAppEvents.o RCTFBSDK/core/RCTFBSDKAppEvents.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
1863
(1 failure)
Any ideas to what I can do? It'd be nice if we could use this solution for now so that all developers (and the buddybuild CI) can pull it instead of having to download the SDK and put it documents folder.

This is generally a result of an incorrectly configured repository with regards to the location of FBSDK dependencies.
If you take a look at: https://github.com/facebook/react-native-fbsdk/blob/master/ios/RCTFBSDK.xcodeproj/project.pbxproj
You will notice that RCTFBSDK will look for dependencies in one of two locations:
~/Documents/FacebookSDK
$(PROJECT_DIR)/../../../ios/Frameworks
The second option is the correct option for continuous integration systems like buddybuild.
In other words, you MUST place your FBSDK dependencies under the "ios/Frameworks" folder in order for it to work on a continuous integration system.
You can find more information about this in our react-native documentations.
Please let me know if this helps!

Related

iOS swift app build fails with cyclic dependency error in Xcode 14+

I have a swift iOS app with two static libraries - lib1 and lib2 (say). Lib2 has a dependency on Lib1 (i.e it imports Lib1 to use its types). Lib1 and Lib2 are set as dependencies for the AppTarget (when built, results in the .app file).
I get the following cyclic dependency error when building Lib1. Similar error is observed when building the other targets.
SwiftDriverJobDiscovery normal x86_64 Compiling <FileName1>.swift (in target '<Lib1>' from project '<ProjectName>')
error: Cycle inside <Lib1>; building could produce unreliable results.
Cycle details:
→ Target '<Lib1>': Libtool /Users/<user-name>/<some-path>/<Lib1>.a normal
○ Target '<Lib1>' has Swift tasks not blocking downstream targets
○ Target '<Lib1>': SwiftGeneratePch normal x86_64 Compiling bridging header
○ Target '<Lib1>': SwiftCompile normal x86_64 Compiling <FileName2>.swift /Users/<user-name>/<some-path>/<Filename2>.swift
○ Target '<Lib1>': SwiftGeneratePch normal x86_64 Compiling bridging header
Raw dependency cycle trace:
target: ->
node: <all> ->
command: <all> ->
node: /Users/<user-name/<some-path>/<Lib1>.a -> command: P1:target-<Lib1>-6d14b29d8d3402955e18e7b7c2cd5bd8502d5dd7097f7536813aba73cac1c1d5-:Debug:Libtool /Users/<user-name>/<some-path>/<Lib1>.a normal ->
node: /Users/<user-name>/<some-path>/x86_64/<FileName3>-8014457a59adc1f8a995a14873eb809b.o ->
command: P0:target-<Lib1>-6d14b29d8d3402955e18e7b7c2cd5bd8502d5dd7097f7536813aba73cac1c1d5-:Debug:SwiftDriver Compilation <Lib1> normal x86_64 com.apple.xcode.tools.swift.compiler ->
CYCLE POINT ->
customTask: <SwiftDriverJob identifier=-4908891831242875468 arch=x86_64 variant=normal job=<PlannedSwiftDriverJob [target(7)]:GeneratePch <Lib1> dependencies=["target(8)", "target(9)", "target(10)"]> isUsingWholeModuleOptimization=false compilerPath=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc> ->
customTask: <SwiftDriverJob identifier=-4908891831242875468 arch=x86_64 variant=normal job=<PlannedSwiftDriverJob [target(8)]:Compile <Lib1> <FileName2>.swift dependencies=["target(7)"]> isUsingWholeModuleOptimization=false compilerPath=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc> ->
customTask: <SwiftDriverJob identifier=-4908891831242875468 arch=x86_64 variant=normal job=<PlannedSwiftDriverJob [target(7)]:GeneratePch <Lib1> dependencies=["target(8)", "target(9)", "target(10)"]> isUsingWholeModuleOptimization=false compilerPath=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc>
In the above error message, FileName1 and FileName2 are swift files that invoke C++ methods using an intermediate ObjC++ bridge layer. I have two files named FileName3 but different extensions - .swift and .mm. Since, FileName2 is referred as .o here, I think it is referring to FileName3.mm (i.e the ObjC++ file).
I have checked the code thoroughly for any form of cyclic dependency (like, two classes depending on each other - as mentioned in many stackoverflow posts), but it's all good. What's more, the same build worked on Xcode 13.x. After updating to Xcode 14.x, I'm getting this cyclic dependency error.
But in the last three lines of the error message, you can see a cyclic dependency.
First step: [Target(7)] Generate pch and depends on [target(8), target(9), target(10)]
Second step: [Target(8)] Compile FileName2.swift, depends on [target(7)]
Target(7) is dependent on target(8) and target(8) is dependent on target(7). What is target(7), target(8) etc? Where can I find out what kind of target it exactly is?
I use cmake to set the dependencies and generate the Xcode project.
What is this error? What am I missing here?
I've been stuck for days and any help would be greatly appreciated.
After so much time spent on searching, this is the answer.
Checkout ctietze's answer to this post in Apple forum
defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 0
After disabling the new build system, I'm not getting the cyclic dependency error anymore.

No such module 'Amplify' & Could not read serialized diagnostics file: error("Invalid diagnostics signature")

I'm trying to compile an Xcode project. I'm getting 2 runtime errors:
No such module 'Amplify'
&
/Users/????????/Library/Developer/Xcode/DerivedData/screener_app-gkvpndyzdgqrsreqyokgisatdzav/Build/Intermediates.noindex/screener_app.build/Debug-iphonesimulator/screener_app.build/Objects-normal/x86_64/AuthButtonView.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'screener_app' from project 'screener_app') Command CompileSwift failed with a nonzero exit code
The screenshot is seen below.
I have tried a handful of things:
cleaned build folder
install/update pods
removed derived data
I'm not sure what to do from here. Any advice is appreciated.
Edit: I am seeing that the workspace is compiling but the project folder is not.

Azure pipeline fails during xcode build for iOS project

Trying to build iOS project with xcode build. Using -
Xcode 12.4
Agent Specification - macOS-10.15
Workspace or project path - Project.xcworkspace
Configuration - Release (Tried with Debug also, it gives more error)
Scheme -valid name
SDK - iphoneos
Now After xcode build using Azure pipeline give following error.
We can build this xcode on locally and Gitlab too. But same code is failing on Azure Devops.
Kindly help.
2021-05-12T13:00:30.6465950Z ❌ /Users/runner/work/1/s/Project/Framework/csdk_common.framework/Modules/module.modulemap:2:19: umbrella header 'csdk_common.h' not found
2021-05-12T13:00:30.6466920Z
2021-05-12T13:00:30.6468430Z umbrella header "csdk_common.h"
2021-05-12T13:00:30.6471390Z ^
2021-05-12T13:00:30.6471830Z
2021-05-12T13:00:30.6472160Z
2021-05-12T13:00:30.6472470Z
2021-05-12T13:00:30.6473810Z ❌ /Users/runner/work/1/s/Project/TTS/main_internal.swift:2:8: could not build Objective-C module 'csdk_common'
2021-05-12T13:00:30.6474420Z
2021-05-12T13:00:30.6475000Z import csdk_common
2021-05-12T13:00:30.6475580Z ^
2021-05-12T13:00:30.6475930Z
2021-05-12T13:00:30.6476250Z
2021-05-12T13:00:30.6730310Z ** BUILD FAILED **
2021-05-12T13:00:30.6731680Z
2021-05-12T13:00:30.6732100Z
2021-05-12T13:00:30.6732840Z The following build commands failed:
2021-05-12T13:00:30.6733510Z CompileSwift normal arm64
2021-05-12T13:00:30.6740330Z CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
2021-05-12T13:00:30.6746120Z (2 failures)
2021-05-12T13:00:30.7025590Z ##[error]Error: /usr/bin/xcodebuild failed with return code: 65
2021-05-12T13:00:30.7365340Z ##[section]Finishing: Xcode build
Please check the repos branch, and make sure you have added this under framework header file. Maybe you did not push the right project and necessary part into the azure devops repos.
#import "xxx\csdk_common.h"
More info you could check this issue and that.

IPA Processing Failed: Could not resolve #executable_path

I am stuck with this error when exporting IPA.
I did refer similar questions and none of them worked for me.
I am migrating my project from carthage to SPM, most of the frameworks which I use support SPM and only two had XCFrameworks.
Have added XCFrameworks with Embed & Sign, and earlier I used to have the simulator architectures removal script, with XCFrameworks I have removed that from my build phase step now.
When looked in the standard log I could not spot any error when searched with "fail"
Is there anything in the standard log which would indicate an error which I should be looking for ?
EDIT: Before you close as Duplicate of How to fix "IPA processing failed" error in xcode 11?
Please check this is for Xcode 12 with SPM & XCFrameworks !
The only errors I can spot in the logs are below:
2021-02-10 09:37:47 +0000 Scanning IPA...
2021-02-10 09:37:50 +0000 warning: Failed to resolve rpath for **SDK: Could not resolve #executable_path for #executable_path/Frameworks from **SDK
2021-02-10 09:37:50 +0000 warning: Failed to resolve rpath for ***: Could not resolve #executable_path for #executable_path/Frameworks from ***
But when I compared with the logs from another project with similar set up, I can see the same set of "warnings" and I am able to generate IPA on the another project.

Marmalade iOS multiple architectures support

The instruction for building marmalade extension static lib-wrappers from the official site shows how to build only single architecture (armv6) extension. I tried to include many architectures into the project:
if {{defined I3D_OS_IPHONE}}
{
includepath incoming
files
{
["MyTracker Library armv7"]
(incoming/armv7)
"*.o"
["MyTracker Library armv7s"]
(incoming/armv7s)
"*.o"
["MyTracker Library armv64"]
(incoming/armv64)
"*.o"
["source"]
(use_first_found, source/iphone, source/generic)
MyTracker_platform.mm
#Add any iphone-specific files here
}
}
But I got many error messages after trying to build it:
Executing: '/usr/local/bin/scons -Q compiler=clang'
scons: warning: Support for pre-2.7.0 Python version (2.6.8) is deprecated.
If this will cause hardship, contact dev#scons.tigris.org.
File "/usr/local/bin/scons", line 192, in <module>
Librarian [ar] /Users/misha/Documents/MyTracker/lib/iphone/libMyTracker.a
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: archive member: /Users/misha/Documents/MyTracker/lib/iphone/libMyTracker.a(MyDispatcher.o) cputype (7) does not match previous archive members cputype (12) (all members must match)
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: archive member: /Users/misha/Documents/MyTracker/lib/iphone/libMyTracker.a(MyTracker.o) cputype (16777223) does not match previous archive members cputype (12) (all members must match)
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: archive member: /Users/misha/Documents/MyTracker/lib/iphone/libMyTracker.a(MyNetwork.o) cputype (16777228) does not match previous archive members cputype (12) (all members must match)
....
malformed object (unknown load command 1)
ar: internal ranlib command failed
scons: *** [/Users/misha/Documents/MyTracker/lib/iphone/libMyTracker.a] Error 1
Executing 'scons -Q' failed. (return code 2). Retry
error: Executing 'scons -Q' failed. (return code 2)
FAILED (error code=3)
How to build an extension with multiple architectures support?
This is typically not the advised way to handle this. You look like you're trying to bring in symbols from those libs, something that the EDK does not support. Your best option is to include these libs (or most probably, just the arm6/7 lib, depending on how low you want to take it) at deploy time along with the compiled extension and instead, compile the extension using a header file (either supplied by the developer of any SDK you're using, or one you've written to compile those .o libs).
Building for multiple targets is something that is being refactored. My understanding is that at some stage both the documentation and the underlying code has got stale. I believe the approach will be quite different from what you are trying to do - I'm not sure why you are pulling in .o files but generally that does work too well in marmalade.

Resources