Missing dylibs from Framework location - ios

After successfully building and archiving app, I'm trying to upload it to iTunes Connect, using Xcode Organizer.
The application successfully passes the validation and it uploading to iTunes Connect.
But then iTunes Connect sends me mail:
We identified one or more issues with a recent delivery for your app, "[APP_NAME]". Please correct the following issues, then upload again.
Invalid Swift Support - The expected dylibs are missing from the app’s
Framework location, such as /Payload/[APP_NAME].app/Frameworks.
All the Frameworks and Libraries are linked to project.
Since app works on React Native and uses some Swift Libraries, I setted these values:
For main project: Always Embed Swift Standard Libraries = Yes
For custom framework: Always Embed Swift Standard Libraries = No
What I'm doing wrong? If app building and working on simulator.
P.S.: Also, i use these libraries: Google Signin and FacebookSDK, and they are both linked.

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

Proper way of embedding dylib into an iOS app

I have a project which consist of three elements:
C source code that is compiled to .dylib
Swift framework used to provide user-friendly swift API for .dylib
iOS app consuming both .dylib and swift proxy
I have added both swift proxy and .dylib as "Framework and libraries" dependency to iOS app project. Things work as expected on my iPhone. However when I attemt to send my app to Apple Store Connect I get following error:
ITMS-90429: Invalid Swift Support - The files libswiftDarwin.dylib, libswiftDispatch.dylib, libswiftCoreGraphics.dylib, libswiftCoreFoundation.dylib, libswiftCore.dylib, libswiftFoundation.dylib, libswiftObjectiveC.dylib aren’t at the expected location /Payload/Runner.app/Frameworks. Move the file to the expected location, rebuild your app using the current public (GM) version of Xcode, and resubmit it.
I figured this can be caused by .dylib file being embedded directly in iOS app, so I tried to embed .dylib into swift framework. Then I made iOS app embedding only swift framework, which consist of .dylib file. However I am getting following error in this configuration:
dyld: Library not loaded: #rpath/libX.dylib
Referenced from: /private/var/containers/Bundle/Application/.../swiftProxy.framework/swiftProxy
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/.../swiftProxy.framework/Frameworks/libX.dylib: code signature in (/private/var/containers/Bundle/Application/.../swiftProxy.framework/Frameworks/libX.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
This doesn't make sense for me, but I figured this is not the right way.
So the question is: how do I properly embed dylib so that it can be put on Apple Store Connect and then on Testflight?
I'm aware that this question was asked at least once, but there is no decent answer. Here for example: How to properly embed 3rd party .dylib files in iOS app project for App Store release?
Thank you

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'

Issue with nested Framework for Watchkit Extension

My Watchkit app does not work in production (TestFlight && rejected from AppStore).
I think the issue come from a nested framework. Here the architecture :
I've made a framework "ModelLayer" (Cocoa Touch Framework) with the app's model, so it can be shared across all targets. This framework use another third party framework (UICKeyChainStore.framework).
And the apple watch extension use "ModelLayer".
When debugging everything works fine. But when I uploaded the archive on iTunes connect I had an error saying that nested frameworks where not allowed. So I removed the copy file phase that I had in the Build Phase of "ModelLayer"'s target. It did not worked well as the app has been rejected...
I found some threads on internet that says that the copy file phase should have as Destination 'Shared Frameworks' and not 'Frameworks' (as I've done before). So I tried this, I've uploaded a pre-release of my app on itunes connect and tried the app with testflight. The app is now on my Apple Watch, but impossible to load the app. The loader stay on screen.
Did I miss something ? How can I use UICKeyChainStore.framework in my 'ModelLayer' framework ??
Thanks in advance !
So I found the solution.
The third party framework in my custom framework was not the problem. But It was my custom framework in the watch kit extension. So it's not possible to embed directly a framework in an extension. The framework should be embedded by the main app. And the extension will be able to use it.
Add the framework to the main app target
In Build Phases Tab
Use the framework in extension target
In General Tab
And in Build Settings Tab -> Linking
Add #executable_path/../../Frameworks to Runpath Search Paths

Fails to distribute my app: "Your app contains non-public API usage."

After I fixed some bugs and refactored my project which has been release on App Store, it fails to distribute. The Xcode shows the following error message:
Your app contains non-public API usage. Please review the errors, correct them, and resubmit your application.
The app references non-public symbols in Payload/XXX.app/XXX: UICreateCGImageFromIOSurface
XXX is the app name.
I've search the entire project, and didn't find any this keyword (UICreateCGImageFromIOSurface). How can I fix this?
Remove Reveal.framework from your project. This should not be linked in release mode of your binary.
You app contains code not only from sources, but from all statically linked libraries. You have to check all of those for containing private call. Looks like at least Reveal library contains it.
Double check any third-party libraries you are using in your project
I was facing the issue and after checking my pods file, I found that Look Back - Framwork which is available for debug builds only as for as I know. So removing that fixed the issue. Successfully submitted app through Xcode 6.1 for Apple Testflight beta testing :)
Never ship an app linked against the Reveal library. Reveal exposes
your app to deep introspection and will likely cause your app to be
rejected by the Apple review team. Reveal is intended for internal
development and debugging purposes only.
The Reveal service will stop automatically while the iOS host app is
not the frontmost app. It will automatically start again when the app
is re-opened.
Reveal supports inspection of applications compiled against iOS 6 and
later. The iOS Deployment Target build setting must also be 'iOS 6.0'
or later. You may see link errors if this is not the case.
Reveal uses Bonjour to connect with the running iOS application. If
you are running the iOS application on a device, it will need to be
on the same network as the Reveal Mac app to be able to connect with
it. If you have any problems connecting to your application check
your firewall and proxy setting to ensure they are not blocking
communications.
Find out more...
cordova plugin rm cordova-plugin-ionic-webview
cordova plugin add cordova-plugin-ionic-webview#4.1.0

Resources