Xcode12 file not found - xcode

Just updated my project to Xcode12 and tried to compile. I keep getting "file not found" errors for multiple modules from the pods included in my project.
I tried to follow these instructions mentioned here but that didn't work.
Error: Could not build Objective-C module 'Firebase'
I still see this error
Btw, this error isn't specific to just Firebase. My project is mostly objective c with some swift files.
Any thoughts on how to fix this ?

Changing the 'Build Active Architecture' to NO in the pods project fixed the issue for me.

Change the Build System can fix the errors. On your Xcode Workspace, Go File -> Workspace Settings. Then change to "Legacy Build System".

See my explanation, which contains the second section that can help by some Podfile attachment:
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] =
"arm64"
end
end
and some project configurations, for more info go to:
https://github.com/ElizaSapir/KnowlageSharing/blob/main/Xcode12Issues.md

Related

How do I archive Xcode project?

I am currently having issues when attempting to archive my project in Xcode. The following error below appears when archiving:
The link Xcode 12 Error: Multiple commands produce AccessibilityResources.bundle mentions to remove React-Core.common-AccessibilityResources from my target but I do not have this under my target. Can someone please assist?
I am using Xcode version 12.1.
This is what I have in the workspace settings:
Thank you.
I changed the derived data location but still getting the same error:
I am now seeing the below error after updating my Podfile.
Current error:
Updated Podfile:
Have a try with the below solution.
Initially clean the build cache data with the below steps:
You can go to File > Workspace Settings if you are in a workspace environment or File > Project Settings for a regular project environment.
Then click over the little grey arrow under the Derived data section and select your project folder and close the workspace and Xcode then delete the project directory from the derived data directory.
Open the workspace again in Xcode and clean and rebuild the project.
Also, make sure that you have applied pod install after the package installation.
Then, open workspace and set the active scheme as Any ios Device (arm64, armv7)
Click on Project from top Xcode Menu
Then select Archive.
Have a break till the Archive process completes.
Remove the below lines from PodFile:
use_flipper!()
post_install do |installer|
flipper_post_install(installer)
end
and do pod install in ios directory.

error: conditional compilation flags must be valid Swift identifiers (rather than 'DEBUG”')

I'm trying to build my project with Xcode 9 beta 6 (9M214v). Also, I'm using CocoaPods. I've converted to Swift 4 and updated my project settings, but I keep getting this error.
Things I've tried so far:
Clean project and build folder
Deleting / re-adding pods
Restart Xcode
Remove Active Compilation Conditions flags
Anyone has an idea how to solve this?
Error message:
<unknown>:0: error: conditional compilation flags must be valid Swift identifiers (rather than 'DEBUG”')
Command /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
Podfile
target 'iOS Application' do
use_frameworks!
pod 'SwiftLint'
pod 'RealmSwift'
pod 'ReachabilitySwift'
pod 'Fabric'
pod 'Crashlytics'
end
Found the error! In my iOS Application target's Build Settings, at Swift Compiler - Custom Flags > Other Swift Flags. There was a ”, instead of " at the end of the flag. I have no idea how this happened, but the quotation mark caused the error.
I find when you modify your "x-Code" setting for custom flags "Debug" to delete "-D",and then replace your swift language version to "Swift 4.0" ,It will fix your problem! Hoping help you...

How to add spotify framework to an custom pod

I try to add the Spotify framework to my custom cocoaPod project but i got an error :
ld: framework not found Spotify
clang: error: linker command failed with exit code 1 (use -v to see invocation)
i added the framework in the Build Phases of project and the search Path to.
but can't build.
Any one can help me please.
Sorry for my bad english.
Are you following some kind of tutorial for this? This shouldn't be an issue with Cocoapods, unless I'm misunderstanding something.
Make sure you clean your project first. I would remove the work you did in Build Phases, the intention of Cocoapods is to avoid adding frameworks manually as an embedded dependency.
Before a pod install, close your project. Pod install and then open up your workspace file once complete, not your xcodeproject file. Try building now. Build again with your imported pod statement. Please update if you need help further.

Xcode: ld: library not found for -lAFNetworking

Because of this one reason, build always fails...Any ideas about what I could try?
EDIT: the solution is to open the xcworkspace instead of the xcproject!
Might be you are opening .xcodeproj file after installing pods. Close the project and open .xcworkspace file.
Have the same issue.
What I did with the help of https://premium.wpmudev.org/forums/topic/anybody-solved-this-linker-command-failed-with-exit-code-1 and Adlair Cerecedo-Mendez
Delete the "Pods" project on the left panel of Xcode.
Close Xcode and delete this file in the finder too.
Install pods again.
Open Xcode and clean.
Verify that the build option "Build Active Architecture Only" is set to "NO" for your project but also for your Pods project (selection with left panel).
Click on your project Scheme (top, near the stop button) and "Manage Scheme".
Check, select all your pods libraries and close.
Then, for all libs, select them (scroll the list) and build manually for the selected architecture.
Every time you change your architecture (simulator, device or for archive(Generic iOS Device)) you must do the above step: namely, manually build each libraries by selecting them in your scroll list one by one, and only than build and run your main project.
Seems a bit WTF, but it is the only way I resolve this issue...
I Had this Issue several Times with PODS Libraries.
Here is something you can Try:
Run pod cache clean --all and pod install again.
Check your Header Search Paths and Library Search Paths, Remove all entries and place $(PROJECT_DIR) in recursive mode and $(inherited) as a Second Entry
Go to your target Build Settings -> Other linker flags -> double click . Add $(inherited) to a new line.
Make sure Build Active Architecture Only is set to NO in the Pods project settings.
I'm thinking on two possibilities:
1) Install cocoapods-deintegrate project:
$ gem install cocoapods-deintegrate
Then run $ pod deintegrate, after that run $ pod install again. If it not works, then...
2) You can try open your Pods project and create new scheme for the target that you need, in this case for AFNetworking.
When the static library is created, then add it to your Frameworks references into your main project.
Hope that helps.
I have in project->TARGETS->Build Phases ->Link Binary With Libraries one "extra" framework that remains from recent project. Delate it and all run smoothly
Had a similar issue ... took a while to realize that I had updated my app's "iOS Deployment Target" to iOS 9.0, but the Pods project's "iOS Deployment Target" was still iOS 8.0!!!
I encountered this error when I downloaded some code from github. I tried to build .xcodeproj file but it failed giving the library not found error. I then opened .xcworkspace file and build that file first by clicking Product -> Build for -> Running. The workspace file built fine with no errors. Then in workspace file I changed scheme to the xcode project I was trying to build, and clicked Product -> Run. The app got built and ran with no errors.
I had this issue while using fastlane with a ReactNative project. I had added a dependency that required cocoapods.
My Fastfile looked like this:
...
gym(
scheme: "AppName",
project: "./ios/AppName.xcodeproj"
)
....
And had to change it to the workspace like this:
...
gym(
scheme: "AppName",
workspace: "./ios/AppName.xcworkspace"
)
...
For me all this thing not help. Only delete in Build settings project.
open xcode, from the top left select the pod library that is being shown as not found.Use 'Command B' to build this pod, then again select your target scheme and run.
For me this fixed it.
Use the xcworkspace to build instead of the xcproject?
This usually happens when using Cocoapods and you are building from the xcproject which doesn't know about the cocoapod libraries.

Xcode 5.0.2 dyld: Library not loaded: #rpath/XCTest.framework/Versions/A/XCTest

I have problems running a project in Xcode 5.0.2
I get the following error:
dyld: Library not loaded: #rpath/XCTest.framework/Versions/A/XCTest
Referenced from: /Users/chris/Library/Developer/Xcode/DerivedData/relatio-cwlmozvklaldmictbbjthzuoxnxz/Build/Products/Debug/relatio.app/Contents/MacOS/relatio
Reason: image not found
(lldb)
How do I solve this issue?
It looks like your main target is linking to XCTest.framework as well as your test target. It should only be linked to the main target.
1) Go to Project settings
2) Go to your apps main target -> other linker flags
3) remove '-framework XCTest'
4) make sure the 'other linker flags' field for your test target still contains '-framework XCTest'
I ran into this error by renaming my targets one of which was a testing target. After reading the other answers I realized that my Build Phases > Compile Sources was including test classes as compile sources for non-test targets which then tried to import the XCTest framework.
Removing the test classes from my regular target’s Compile Sources solved this for my case.
I solved this problem this way.
I have edited scheme, at "Build" tab ticked "Run".
The problem here is that, according to the dyld error message you posted, your application is linking against XCTest.framework. That's incorrect; only your test bundle needs to link against XCTest.framework since only your test bundle contains tests.
I had similar problem with OCMock library and solution is:
target :"Application Tests", :exclusive => true do
pod 'OCMock'
end
In my case It was RxTests added by Swift Package Manager to main application target. In pods you decide which Rx components add to which target, but SPM adds it all to main target as default.
This is how I solved the problem:
Navigate to the project's "Build Settings"
Search for "Runpath Search Paths"
Enter the following path in the column below the product name: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/
In my main Target's "Link Binary With Libraries" (under Build Phases), it was the testing framework I was using (Nimble.framework) that was causing the problem. Removed it, and everything's fine!
enter the reference of your framework on framework search path AND
Run path search path under "Build Settings"---...Now all set to invoke your projects by using import
I have same issue is because i add a new file into the framework. So just run "pod install" solved my issue. But make sure your pod under Tests target too.
Just for the ones that came up with the same issue:
Check on the lateral right menu which has to look like that:
And has not have to look like that:
For our case, we want to use Mockingjay for both app target and test target
target 'MyProject' do
pod 'Mockingjay/Core'
# all pods that are not test go here
target 'MyProjectTest' do
inherit! :search_paths
pod 'Mockingjay/XCTest'
pod 'Quick', ' ~> 0.9.2'
# .. all test pods go here
end
end
A solution that worked for me was changing your test target's inherit attribute in your Podfile from :search_paths to :complete.
Although this answer suggests that :search_paths is designed for test environments.
target 'myapp' do
use_frameworks!
target 'myappTests' do
#inherit! :search_paths
inherit! :complete
end
end
I had this error using ios-snapshot-test-case v5.0.2 via Carthage. The problem is related to XCode 11. Apple renamed libswiftXCTest.dylib to libXCTestSwiftSupport.dylib and added XCTest.swiftmodule which has the same symbols in it and can work in place of the old one. But Apple forgot to tell iOS 11.x simulators about this change.
So you need to fix the older iOS version simulators. Here is the terminal command that fixed it for me:
sudo zsh -c ' sourcedir="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib";
targetdir="/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 11.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib";
ln -s $sourcedir/libXCTestSwiftSupport.dylib $targetdir/libswiftXCTest.dylib;
ln -s $sourcedir/XCTest.swiftmodule $targetdir/XCTest.swiftmodule'
See my comment here: https://github.com/CocoaPods/CocoaPods/issues/9165#issuecomment-573523322
Go to General > Targets (Left side).
You might have 2nd item containing the word test/s. Click it.
In this general settings > Testing > Host application > Select from options (your app name). That's it!

Resources