Universal linking iOS - where is the .xcodeproj file? - ios

I've been trying for days to get Universal Linking working on iOS for React Native.
The docs here say "On iOS, you'll need to link RCTLinking to your project". I'm then told to go to node_modules/react-native/Libraries/LinkingIOS and drag a .xcodeproj file into my project.
None of the libraries in the Libraries folder whatsoever have any .xodeproj files in them.
Is there meant to be? Is my react-native instance missing something? Googling this issue pulls up nothing at all - does everyone else have .xcodeproj files in their Libraries folder??

Starting with version 0.60 React Native provides auto-linking.
To have the library available in RN versions newer than 0.60 you have to:
1) Add reference to LinkingIOS folder into header search paths
in
Xcode -> project target -> projectName ->Build Settings -> header search paths:
$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS
2) Import it in AppDelegate.m
#import "RCTLinkingManager.h"
About the other steps that you need to do:
upload an apple app site association file to your web server,
preparing the app for universal linking in developer.apple.com and
setting up universal links in Xcode and RN code
you can check this link:
https://www.ekreative.com/blog/universal-linking-in-react-native-for-ios/
Just ignore the manual linking paragraph on that page.

Related

How can I properly share the Amplify framework with my Main App and my App Extension for an iOS app?

I have an iOS app using AWS amplify for the backend. I am using Xcode 13 and SwiftUI.
I previously added the Amplify framework using Cocoapods however I was unable to get the framework to work with the extension.
So I recently switched to Swift Package Manager. I added the package to my main project. Then I went to my Share Extension and in General - Frameworks and Libraries and manually added the libraries.
After doing this the app builds and runs and both the main app and extension work fine and are able to use the libraries.
The problem is that I cannot archive and upload the app to the App Store. I get the following error:
CFBundleIdentifier Collision. There is more than one bundle with the
CFBundleIdentifier value 'com.amazonaws.AWSAuthCore' under the iOS
application 'MyAPP.app'. With error code
STATE_ERROR.VALIDATION_ERROR...
I went on many forums and spent many hours trying to fix this but to no avail. The suggestions are to click 'do not embed' for the libraries but that option is not available for me.
I wonder if there is anyway to resolve this?
Below are my General and Build Phases for the Share Extension:
Just remove explicit Amplify dependency from extension, ie. next section should be empty
Make sure (it should be automatically, but anyway)
Link Frameworks Automatically parameter (in Build Settings) is true
Runpath Search Path parameter is related to main bundle
So as targets from SPM are built in same location as product and extension and automatic framework linking is enabled the imported modules in extension will available and linked automatically and due to run paths are set the frameworks will be found in run-time as well.
Note: of course in main app target all should be included
Tested with Xcode 13.1 / iOS 15.1

Can't submit iOS app to iTunes connect when using a SPM package

When I try to submit an iOS app that includes an SPM package which uses the new binary target the submission fails with the following two errors:
Invalid Swift Support. The file MyApp.app/Frameworks/libHello.a doesn’t have the correct file type for this location. Ensure you’re using the correct file, rebuild your app using the current public (GM) version of Xcode, and resubmit it.
Invalid Bundle Structure - The binary file 'MyApp.app/Frameworks/libHello.a' is not permitted. Your app can’t contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure.
I believe it's to do with SPM as when I manually drag the Hello.xcframework package to the project it allows me to submit successfully.
Trying to do other things like changing Xcode build settings, customising the package.swift and using lipo to make sure the architecture slices are valid doesn't lead to anyway.
I looked at the embed framework in Build phases, it's not been included only in the link framework phase. One thing I noticed is when I archived the app the static library libHello.a was in the app's framework folder, which is weird since it shouldn't be there as they are integrated with the app binary. When I delete that file I can continue the app submission without any issues. But I don't think this workaround would be ideal long term.
I've created a simple static library with one class and method to keep thing simple. I then use Xcode archive the resulting static library in an XCFramework using xcodebuild -create-xcframework. See Github Repo: https://github.com/shams-ahmed/Hello
Steps to reproduce:
Create a new Xcode project
Add the Hello SPM package using the SPM interface with URL: https://github.com/shams-ahmed/Hello
Archive the project
Validate the App
You can deselect all the options
Fails with the above error message
What do I need to do to get SPM working with a static library? This is now meant to be supported with Xcode 12 and Swift 5.3
Info:
Xcode 12.0
Swift 5.3
Using a new Xcode project
P.S must use a static library
Looks like it's not possible with static libraries (.a files) because .binaryTarget with a xcframework is associated with dynamic frameworks and XCode just copy a platform depended entity from the xcframework to Frameworks folder of your .app instead of linking to your application's binary.
XCode build log:
PBXCp .../Hello.xcframework/ios-x86_64-simulator/libHello.a .../Test.app/Frameworks/libHello.a
There are two solutions:
Compile library sources as dynamic frameworks and make the xcframework from them.
If you have .a files only you can make dynamic frameworks wrappers which link static libraries and provides API access to them and then make the xcframework.

iMessage app, "disallowed nested bundles" error trying to archive/upload with binary framework

I have an iMessage app (not an app with an iMessage extension) in which I have successfully added a binary framework (the project runs just fine on device and simulator)
However, I cannot successfully upload the project to App Store Connect - upload from the archive build returns the following errors:
The relevant text of the error is:
The bundle ... contains disallowed nested bundles. Refer to https://developer.apple.com/go/id=framework-imessage
That link (if you follow the instructions for using an newer Xcode version) leads you back to the link below I used to add the framework to begin with... to run you will need Xcode 11 as I am using an XCFramework.
I added the framework to the iMessage app as instructed by Apple here:
https://developer.apple.com/library/archive/technotes/tn2435/_index.html
(see Embedding a Framework in an iMessage App section)
What do I need to change to the settings for the project or extension in order for the archive/upload process to succeed, while actually including the framework I need? I have searched on StackOverflow, and found a variety of posts related to cocoapods, or around various build settings of "Always Embed Swift Standard Libraries" that do not help.
I have reduced the problem down to a simple sample app you can see here, which builds and runs just fine but cannot be archived and uploaded:
https://www.dropbox.com/sh/jpa4oe7zlnb21wl/AACXkLbxIbayZUtJr3VDwO07a?dl=0
That directory contains a zip file of the project, and an image showing the error encountered.
You have .xcframework in your project. May be you haven't enable Build Libraries for Distribution in Build setting when you have build .xcframework. You can refer this link for this.
Edit:
Error message is Invalid Bundle. So check bundle name of message extension and frameworks which are in the .xcframework.
I've made a few changes regarding the stub app, it seems to work and validate ok.
Remove the Embed Framework from the extension target.
Add the Embed Framework in the app target, set the Destination to 'Frameworks'

React native facebook login in ios undefined symbols for architechture x864

I'm trying to add facebook login on react native latest version 0.49 by follow this tutorial
https://github.com/facebook/react-native-fbsdk
I did step by step and see some videos on youtube and did exactly but I still get the same 28 errors
I guess maybe it's because in the link Binary with Libraries I can't see the FBSDK, even I added it as explained on tutorial to Frameworks folder
I saw some posts in stack overflow e.g
React Native iOS build failed : Undefined symbols for architecture x86_64
but without any help.
thanks.
There is an issue with XCode 9, where when you drag and drop any files, it does not get added to the target.
You need to manually add them to your target in File inspector now.
This can happen not only with frameworks but other files as well. To prevent this issue, whenever you want to add any file or resource to your XCode project, you should first add that file/resource to the project folder and then right-click and then add to your XCode project using Add Files to ..

Cannot find ScriptingBridge.framework

I am new to objective-C.
I have programmed my first App in the last 2 months. I am now trying to access iTunes information and the coding appears to be straight forward but I cannot locate the ScriptingBridge.framework.
I am using Xcode 4.5. I have tried using the "+" button in the Link Binaries with Libraries section of Build Phases but ScriptingBridge.framework does not appear on the list. I have tried opening the framework directory in Finder with no luck. I cannot find a way to download the file independently from installing Xcode.
I have tried uninstalling and reinstalling Xcode. Any suggestions?
Thanks,
BobT
ScriptingBridge.framework is not available for Cocoa Touch.
I don't think you can use the scriptingBridge framework with an iOS Project. You only can use it with a cocoa application project. In a cocoa application project you can add the framework under
Targets -> Build Phases -> Link Binary with Libraries -> +
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/UsingScriptingBridge/UsingScriptingBridge.html

Resources