Batch SDK for iOS 2.0 is distributed in a different way than the 1.x versions.
The 1.x framework were Static Libraries and starting with 2.0.0 it is a Dynamic Library with support for Mergable Libraries.
Due to CocoaPods limitations, Batch is only distributed as a Mergable Library via Swift Package Manager or manually downloading the XCFramework
Support for those frameworks has been introduced in Xcode 15.0, but unfortunately some tooling in the iOS ecosystem is not compatible with Mergable Libraries yet.
This can result in various errors misleading returned by those tools, such as:
Invalid framework Batch.framework
Invalid binary
Code signing failed
IOS_DEPLOY_FAILED A valid provisioning profile for this executable was not found. (BrowserStack)
If you're running into issues but are either:
Using Batch SDK 1.x
Integrating using CocoaPods
then this article does not apply to you, as those versions are not Mergable Libraries. Your issue probably comes from another problem.
If the issue arises with BrowserStack, please don't hesitate to reach out to their support team, as they will be able to help resolve the error you're encountering.
Modifying your project
The workaround is to ask Xcode to create a merged binary, compiling Batch into your main target rather than linking to it dynamically.
This can even be benificial for your app, as statically linked binaries start up faster!
To do so:
Open your Xcode project
Select your application's target
Open
Build Settings
Search for
merged
Set
Create Merged Binary
toAutomatic
While this is an invisible change for most apps, this might cause unexpected issues depending on what dependencies you use and how they've beed added to the project.
Consider testing this change in a TestFlight build, or only configure your project with this setting for builds you send to testing platforms.
If the workaround worked, it is indeed that your service/tool does not support Mergable Libraries. Please consider getting in touch with the provider or maintainer to let them know about this!
If you do not want or are not able to make a Merged Binary, please try another workaround down below or get in touch with our support team.
If this does not work, there are two other ways to work around this:
Cocoapods
Cocoapods
As the Cocoapods is not a Mergable Library, integrating Batch with it works around the issue.
You do not have to switch to Cocoapods for all of your dependencies, only Batch.
Manual integration
Manual integration
Download the CocoaPod framework binary yourself and manually integrate it into the project
You can find the ZIP URL in the Podspec file.
Replace 2.0.2
in the GitHub Podspec URL with the Batch version you want.