Unable to compile React Native Share Extension iOS 12.5 - ios

When upgrading to iOS 12.5, I am getting the compile error that: "Application extensions and any libraries they link to must be built with the APPLICATION_EXTENSION_API_ONLY build setting set to YES."
However, I am explicitly setting it to false in my Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
end
end
end
Because this is required as a work-around for another issue.
If I set config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES', then I get even more issues.
Does anyone know how to fix this issue?

You don't need to change the 'Podfile' file,just set the "Require Only App-Extension-Safe API" to Yes in Building Settings,it works for me.
This address maybe help you more. https://github.com/facebook/react-native/issues/28405#issuecomment-779382959

Related

IOS build errors - Xcode 13

Below are errors while building in latest xcode 13 & Mac Apple Pro M1 chip
<unknown>:0: error: module map file '/Users/xxxx/Library/Developer/Xcode/DerivedData/xx-cwbykxafbbbrfjbaeyuaxhdrivdp/Build/Products/Debug-iphonesimulator/Stripe/Stripe.modulemap' not found
<unknown>:0: error: module map file '/Users/xxxx/Library/Developer/Xcode/DerivedData/xx-cwbykxafbbbrfjbaeyuaxhdrivdp/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap' not found
Command PrecompileSwiftBridgingHeader emitted errors but did not return a nonzero exit code to indicate failure
Most of the answers mentioned to edit pod file & write exclude configuration hence the tried below fix -
installer.aggregate_targets.each do |aggregate_target|
aggregate_target.user_project.native_targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(SDKROOT)/usr/lib/swift', '$(inherited)'] # or it won't build on apple silicon
# without explicitly clearing this out, it flaps between excluding arm64 or not
# Fix some library / linker errors
config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES' # only one at a time
config.build_settings['VALID_ARCHS'] = 'arm64 x86_64' # you need both to work on both CPU archs / release etc
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
aggregate_target.user_project.save
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# We support a smaller range of deployment than some libraries, eliminate related noise
# This also avoids a nasty Folly bug about an API not available until ios10+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end
Also couple of answers mentioned to open workspace file which also tried but these errors are not resolving. Requesting if someone can provide right pointers.
I faced a similar issue with Xcode 14 in M1 Mac running macOS Ventura. The following workaround fixed the issue for me.
Right click on Applications -> Xcode
Choose Get Info
Select Open with Rosetta option if it's not selected

Flutter IOS build error - "select a development team in the Signing & Capabilities editor."

The following error is displayed when attempting to build on an IOS device:
As shown in the picture below, the Signing setting in Xcode is well done.
Can you tell me the cause and solution of this?
Could not build the precompiled application for the device.
Error (Xcode): Signing for "GoogleSignIn-GoogleSignIn" requires a development team. Select a development team in the Signing & Capabilities editor.
/Users/home_1/StudioProjects/Example%20Project/app/ios/Pods/Pods.xcodeproj
Error (Xcode): Signing for "DKPhotoGallery-DKPhotoGallery" requires a development team. Select a development team in the Signing & Capabilities editor.
/Users/home_1/StudioProjects/Example%20Project/app/ios/Pods/Pods.xcodeproj
Error (Xcode): Signing for "DKImagePickerController-DKImagePickerController" requires a development team. Select a development team in the Signing & Capabilities editor.
/Users/home_1/StudioProjects/Example%20Project/app/ios/Pods/Pods.xcodeproj
Error (Xcode): Signing for "gRPC-C++-gRPCCertificates-Cpp" requires a development team. Select a development team in the Signing & Capabilities editor.
/Users/home_1/StudioProjects/Example%20Project/app/ios/Pods/Pods.xcodeproj
This happened to me today after switching to Xcode 14. Try adding this to your podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['WRAPPER_EXTENSION'] == 'bundle'
config.build_settings['DEVELOPMENT_TEAM'] = 'YOUR_DEVELOPMENT_TEAM_ID'
end
end
end
end
Don't forget to replace the YOUR_DEVELOPMENT_TEAM_ID with your actual development Team ID which you can find in developer.apple.com
This will permanently fix the issue.
If you don't want to use the Team ID you can do this instead:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end
end
end
end
If you have other post_install steps, for example flutter_additional_ios_build_settings(target), make sure to keep them
I'm wondering when Apple is going to launch a new xCode version without breaking anything from previous ones!
Rants aside, this is how I fixed my Flutter project based on previous answers:
Open your awesome_flutter_project/ios/Podfile:
and replace these lines:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
for:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end
end
end
end
Just for everyone, who thinks the accepted solution is a hack, you are right. This is a known bug in the flutter framework which has been fixed in flutter 3.3.3 .
So I recommand everyone to upgrade to this version, if you are able/allowed to do so.
In case you can't upgrade to 3.3.3 then the accepted solution is your best bet ;)
It's a Flutter framework issue
Update Flutter version into 3.3.3
I also got this error after updating XCode to version 14.
Add the following to ios > podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
if config.build_settings['WRAPPER_EXTENSION'] == 'bundle'
config.build_settings['DEVELOPMENT_TEAM'] = 'YOUR_DEVELOPMENT_TEAM_ID'
end
end
end
end
To get YOUR_DEVELOPMENT_TEAM_ID: https://developer.apple.com/account/#!/membership/
This will permanently fix the issue.
If you don't want to use the Team ID you can do this instead:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end
end
end
end
I was able to solve the problem by doing the following:
Open project on xCode
Open Pods and find out "GoogleSignIn-GoogleSignIn" and other three on Pods > Target
Select Team on Signing & Capabilities
Open your flutter project in Xcode
Pods -> Targets -> Signing & Capabilities -> Select Team
Select Team for every Targets
I am using CodeMagic.io (CI/CD) and had this same problem, I found the issue to be the Xcode version: 14
I solved this at CodeMagic.io by doing this :
Go to the Workflow Editor
Go to 'Build'
Change the Xcode version: 13.4.1
If you are using another CI/CD try using Xcode version: 13.4.1
It was mentioned to solve this you can also update your Flutter version to 3.3.3 however if like me this is not an option for you try using Xcode version 13.4.1
adding following code solved issue in Xcode 14 and flutter version 2.8
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
When I put the the suggested changes in the pod file and run the flutter build ipa command, I am getting a different error.
Error:
In file included from /Volumes/Data/FlutterSDK/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.9.3/ios/Classes/FWFUIViewHostApi.m:5:
/Volumes/Data/FlutterSDK/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.9.3/ios/Classes/FWFUIViewHostApi.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
For CI/CD, this is the only solution that worked for me.
Update podfile.
target_is_resource_bundle = target.respond_to?(:product_type) && target.product_type == 'com.apple.product-type.bundle'
target.build_configurations.each do |build_configuration|
if target_is_resource_bundle
build_configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
build_configuration.build_settings['CODE_SIGNING_IDENTITY'] = '-'
build_configuration.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = '-'
end
end
then go to the team drop list and select your team

Cocoapods frameworks does not support provisioning profiles

I am new in iOS development world.
I am working in a iOS app development. I am using Cocoapods to integrate third party libraries like Alamofire and KeychainSwift.
When I am export my Archive to generate the .ipa file from local, its working fine. But when I am trying to do the same in my CI tool(Jenkins), its giving Export Failed!.
Its giving the error:
exportArchive: KeychainSwift.framework does not support provisioning profiles.
error: exportArchive: Alamofire.framework does not support provisioning profiles.
Its asking me to:
"Remove this item from the "provisioningProfiles" dictionary in your Export Options property list."
But I will not be able to do that because it requires for my main app.
I did all the tricks over the Internet as below. I added the below line in at the end of the Podfile.
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = ''
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
config.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = ''
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
config.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
end
end
end
After doing this I have reinstall the pods again, but no luck.
Can anyone please help?
I have had the same problems as you recently.It took me a few days, and then I solved it.
I use the .sh command file to package.
Only xcodebuild archive was modified:
PROVISIONING_PROFILE**_APP**="${provisioningProfile}" PRODUCT_BUNDLE_IDENTIFIER**_APP**="${bundleID}"
Important things repeating 3 times:
(Only added : _APP)
(Only added : _APP)
(Only added : _APP)
It was finally solved.

How to build a xcode 9 project with Swift 4.0 using Pods in Swift 3?

I want the main module of my iOS App to compile Swift 4.0 while the CocoaPods module compiles swift 3.
PS: Using Xcode 9 beta 2.
If you are using some pods written in Swift 4, but some are Swift 3.2, here is the way you can specify the SWIFT_VERSION value for them:
swift_32 = ['Pod1', 'Pod2', 'Pod3'] # if these pods are in Swift 3.2
swift4 = ['Pod4', 'Pod5', 'Pod6'] # if these pods are in Swift 4
post_install do |installer|
installer.pods_project.targets.each do |target|
swift_version = nil
if swift_32.include?(target.name)
swift_version = '3.2'
end
if swift4.include?(target.name)
swift_version = '4.0'
end
if swift_version
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = swift_version
end
end
end
end
Finally I got it to work: All I had to do was to put this script in the end of Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.2'
end
end
end
Here is a far less verbose way to set the pods you need to 3.2 and leave all others at 4.0
post_install do |installer|
installer.pods_project.targets.each do |target|
if ['AirMapSDK', 'PhoneNumberKit', 'Lock', 'RxSwift', 'RxSwiftExt', 'RxCocoa', 'RxDataSources', 'ProtocolBuffers-Swift'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.2'
end
end
end
end
Just modify the array in the if statement. everything else will default to 4.0
Project Navigator > Choose 'Pods' > Choose the Swift 3.2 Pod > 'Build Settings' > Scroll down and then set Swift Language Version to 3.2 in 'Swift Compiler - Language section'.
On doing this, Xcode will show one Buildtime issue. It will ask you to convert the source code of pods to Swift 4. Don't do that. Click on that issue > Uncheck 'Remind Me' > Click 'Convert Later'.
Project Navigator
Build Settings
Set Swift 4.0 for all the targets except that framework which should be Swift 3.2
It's what I'm currently doing in a project

TesseractOCRiOS | Warning: Multiple build commands for output file

versions:
TesseractOCRiOS 4.0.0
CocoaPods 1.2.1
When i'm building on simulator - everything is fine, but when i'm trying to build on my iPhone xCode gives me next warning:
Warning: Multiple build commands for output file /Users/Username/Library/Developer/Xcode/DerivedData/ProjectName-hjheurpncvhpfbabezufoumrybad/Build/Products/Debug-iphoneos/TesseractOCRiOS/TesseractOCR.framework/PrivateHeaders/config_auto.h
Faced with the same problem recently, definitely not the best, but acceptable workaround - just delete one of the duplicate lines "config_auto.h" with path "./Pods/TesseractOCRiOS/TesseractOCR/include/leptonica/" in "Build Phases"-"Headers"-"Private" settings of TesseractOCRiOS target.
OCR recognition functionality does not affected by this change.
See screenshot for details.
If you're using cocoapods, you can add following script at the end of your pod file:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'TesseractOCRiOS'
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
header_phase = target.build_phases().select do |phase|
phase.is_a? Xcodeproj::Project::PBXHeadersBuildPhase
end.first
duplicated_header_files = header_phase.files.select do |file|
file.display_name == 'config_auto.h'
end
duplicated_header_files.each do |file|
header_phase.remove_build_file file
end
end
end
end
Just noticed that it's also disabling bitcode. Remove it if that's not what you need. The script removes the duplicate header files since they are under private section only.
I think you have a problem in your project directory. You have a duplicate file of config_auto.h
Go to your Target , Delete config_auto.h under the build phases.
Hope!! This helps you

Resources