Xcode 11.4 archive fails when building target dependency - ios

I have a framework project which gets build using a shell script under Build Phase. It uses xcodebuild to do that.
Since I have updated the Xcode to 11.4, I am getting the following error when the consuming project tries to build the dependency for above framework( The same works fine when I build the framework on it's own).
unable to create directory '/Users/.../Library/Developer/Xcode/DerivedData/App-cnatioifembsmzdvoyyuogceigiw/Build/Intermediates.noindex/ArchiveIntermediates/AppName-Staging/BuildProductsPath/Debug-iphoneos/FrameworkName.framework' (in target 'TargetName' from project 'ProjectName')
I have checked the write permission on the directory. I have given full hard disk access to Xcode under Security and Privacy but it is still happening.
Any guidance will be appreciated.
Thanks in advance.

Related

Build additional target in Xcode: Error 'React/RCTBridgeDelegate.h' file not found in AppDelegate.h

Building my React Native app in Xcode 11.3.1 gives me the error:
"React/RCTBridgeDelegate.h" file not found in AppDelegate.h
only when building an additional target (Release Scheme) directly in Xcode. When building the standard development target, I have no problems.
More detailed:
I have a React Native app with a Watch companion app. The app is equipped with different additional React Native modules. The app runs smoothly when building it in the standard build target (Development scheme) via React Native CLI (react-native run-ios) as well as when building the standard build target (Development scheme) directly in Xcode.
Already a while ago, I have created a duplicate set of targets in Xcode (Release scheme). Building the duplicate target for the iOS app in Xcode bundles the React Native code and images as an additional build phase to be able to deploy the app on an iPhone not depending on the development server. Building this target worked out smoothly as well for a long time.
Now all of a sudden since some days when I want to build my duplicate target (Release scheme) in Xcode I am getting the error
I can still build the standard build target (Development scheme) via console react-native run-ios and also directly in Xcode with no problems. I am not sure what caused this issue now, the only change to my config I have made some days ago is that I have added some additional modules to my React Native app, e.g. react-native-keychain and react-native-push-notification. Both have been configured correctly as I would assume, also pods have been installed as necessary and I can see that those modules also work well when building the development target, so I don't think that adding those additional modules caused the issue.
I have read all issues on StackOverflow describing this problem and have already tried all of the following solution proposals with no effect, unfortunately:
Make sure that "Parallelize builds" is deactivated in the scheme (had already done that by the time when duplicating the development target creating a release target). Also make sure that target "React" is listed above the app build target in "Build" option of the scheme.
De-integrate pods and re-install pods
List additional target in the Podfile with "inherit! :search_paths", again de-integrate and re-install pods --> gives me a warning that the additional target in the Podfile "overrides the HEADER_SEARCH_PATHS build setting"
Clean the build and repeat step 2
Add the React path directly in the HEADER_SEARCH_PATHS in target build settings --> gives me linker errors
Explicitly build target "React" first - Clean Build, Build target "React", then build my release target
I am stuck and would really appreciate your help - do you have further ideas on what I can try out to solve this problem?

Unable to build iOS after renaming Xcode project flutter

I have an issue guys. For some reason, I decided to rename my Xcode project runner folder before sending to the apple store. Now I wanted to rebuild for iOS with this command: flutter build ios. But I get this error each time:
Expected ios/Runner.xcodeproj but this file is missing.
Application not configured for iOS
I also tried building this with Xcode. I got this error each time:
/Users/apple/FlutterProjects/kashbase/ios/Pods/Target Support Files/Pods-Kashbase/Pods-Kashbase.debug.xcconfig: unable to open file (in target "Kashbase" in project "Kashbase") (in target 'Kashbase')
What does this mean and how can resolve this? Any helpful effort will be greatly appreciated.

How to remove scripts (in a framework) when the ios app is archived?

I'm working on a cocoa pod framework which has a couple of shell scripts in it. After installing the pod, the user should add the following in app's build phase -> run script :
“${PODS_ROOT}/MyPod/MyPod/framework/MyPod.framework/scripts/build.sh”
After this the build works fine and app runs. But archiving creates problems. XCode gives an error saying:
iTunes Store Operation Failed
Invalid Signature. Code object is not signed at all. The file at path [SampleApp.app/Frameworks/MyPod.framework/scripts/build.sh] is not properly signed. Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level). Additionally, make sure the bundle you are uploading was built using a Release target in Xcode, not a Simulator target. If you are certain your code signing settings are correct, choose "Clean All" in Xcode, delete the "build" directory in the Finder, and rebuild your release target. For more information, please consult https://developer.apple.com/library/ios/documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html
I've two concerns now:
Xcode doens't allow scripts to be a part of archive?
If thats the case, then how do I remove these scripts from archive? Is there a build setting like ${ARCHIVE_DIR} from where I can search for the latest archive and then remove the script. Or, is there some build setting where I can mention what files to ignore while building or archiving?
Also, I've already tried adding these files to 'exclude source file names' to the app's build settings. It didn't work since the script to be executed isn't a part of the app, but part of the framework integrated in app.
Also, my framework is a fat framework generated by using lipo on simulator build and device build. Which means that framework won't be code signed.
Apple does not allow simulation code inside framework when push to store, to overcome this, either ship the framework without simulator arch, or use external script to remove it during app build.
Example script can be found in some framework like Realm, basically you have to add the script file in your framework, and tell user/dev to call this on their build script (it's the strip-frameworks.sh)
This issue is stated in this archiving universal framework bug

Carthage, Xcode 9. "xcodebuild timed out while trying to read *.xcodeproj" error

Today I downloaded xCode 9 and started converting everything to Swift 3.2/4, so I can build and run my project.
As it was expected carthage complaint about some project that they could not be build, as they were not compatible with Swift 3.2/4. I had to find the versions that were compatible and build them.
I also had to use --no-use-binaries, as some frameworks are precompiled with previous versions of Swift.
I then got the following error:
xcodebuild timeout while trying to read AWSiOSSDKv2.xcodeproj
So far I was probably not getting this error, as i was downloading AWS framework precompiled. Now that carthage had to compile it locally, something was missing and was creating the timeout.
To sort it out I did the following steps:
Open the timed out project in Xcode
Do not do anything
Run "Carthage build --platform iOS"
Everything compiled without any errors. It seams that once the project is opened in Xcode, Xcode is automatically adding something that is missing and the project compiles then.
This process has to be followed after every "carthage update", as the update will download a fresh xcode project.

Unity iOS XCode Build Failed: Apple Mach-O Linker Error

I've been trying to build my Unity game to iOS with Admob, Unity IAP, and Firebase Analytics.
Unity Version: 5.6.2f1 Personal
Xcode Version: 8.3.3
Steps I've completed:
Enabled IAP and Analytics in Unity Service tab, Imported IAP package
Imported Firebase Analytics Package
Imported Admob unity package
Created new Firebase project in the web portal. Downloaded GoogleService-Info.plist file
Put .plist file in Assets folder.
Ensured my player settings in Unity were correctly configured (Bundle Identifier, Version, IL2CPP set, Architecture: Universal, Device SDK set).
Made Xcode project folder (Release mode set in build settings). Build succeeded, no errors.
Opened terminal window and ran "pod init" in Xcode project folder root
Ran "pod 'Firebase/Core'", "pod install". Succeeded
Opened the .xcworkspace file from Xcode
Changed "Enable Modules (C and Objective-C)" to "Yes" in Build Settings for both target and project files.
Downloaded the GoogleMobileAds.framework (from the GoogleMobileAdsSDK zip)
Added the GoogleMobileAds.framework to the list of frameworks in "Build Phases"
Added AdSupport.framework
Added "-ObjC" to "Other Linker Flags" in both Target and Project files.
Cleaned Project
Build Project, Build failed due to linker errors
I've also tried upping the deployment target to 8.0 rather than 6.0 in the general settings and PodFile, but it didn't remove the errors.
Any help would be appreciated. I think I'm just missing a step somewhere in the Xcode configuration but I can't seem to figure it out.
Fixed it! It was a simple mistake on my part. I downloaded an unofficial Google Admob Unity package. This created an "AdmobAPI" folder in my Assets/Plugins which contained the files causing the linker errors.
I didn't notice it right away because this folder was never getting overwritten when I reimported the official packages. It finally caught my eye when I was comparing the directories between my project and Google's sample project which I installed the official packages to.
So in short, double check what you're importing and scan your directories thoroughly if you run into build errors. At this point in time, little to no modification should be needed in Xcode (I didn't need any of those extra steps); Unity does nearly all the work.

Resources