Xcode 8 - Could not build module 'CoreFoundation' in ios10 - ios

using Xcode 8.
iOS 10
Objective-C
Pod file consist :- pod 'XMPPFramework'
i want to integrate XMPPFramework in my project.
installed pods.
after installing pods when i open xWorkspace. these errors comes.
podfile :-
Uncomment the next line to define a global platform for your project
platform :ios, ‘8.0’
target 'Roj' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Roj
pod 'XMPPFramework'
target 'RojTests' do
inherit! :search_paths
# Pods for testing
end
target 'RojUITests' do
inherit! :search_paths
# Pods for testing
end
end
these are the errors which comes in my project see this image

Try this solution in Build settings ;

You can resolve this issue by implementing following changes.
1) Change the following flags in you Project's Build Settings.
2) Rename your module.modulemap files. Name them anything except module and then change the path of this renamed file in your Xcode.
Clean it, Build it, it will resolve the issue.
P.S - Other compilation issues will get resolved automatically.

This may help:
Go to Build Settings
Search for Compile Source As
Set it to Objective-C++
See this issue: https://github.com/react-native-community/react-native-google-signin/issues/361#issuecomment-379013147

Related

iOS/Swift: "No such module..." for UI Testing

I'm trying to create automated UI tests for my iOS app. After generally failing to get this working on my existing app, I created a new one from scratch and tried there. It always seems to fail because it can't import dependencies I've installed with Cocoapods.
I'm currently running XCode Version 10.2.1 (10E1001)
Instructions to replicate:
Launch XCode, create new project (Single View App, Swift, unit tests and UI tests). I named my project UITestProto
Run pod init on the project.
Add the HydraAsync dependency
The Podfile should look like this:
# Uncomment the next line to define a global platform for your project
platform :ios, '12.2'
target 'UITestProto' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for UITestProto
target 'UITestProtoTests' do
inherit! :search_paths
# Pods for testing
end
target 'UITestProtoUITests' do
inherit! :search_paths
# Pods for testing
pod 'HydraAsync'
end
end
Go to the Build Settings of the UITestProtoUITests target in XCode and set "Always Embed Swift Standard Libraries" to $(inherited):
Run pod install
Open the project using UITestProto.xcworkspace
Open the UITestProtoUITests.swift file and try to import the OHHTTPStubs module.
import XCTest
import Hydra
class UITestProtoUITests: XCTestCase {
...
At this point you should see the error:
No such module 'Hydra'
I've tried:
adding #testable import UITestProto because I've had to do that for my unit tests
Making sure "Enable Testability" in "Build Settings" is set to "Yes"
And I've cleaned the build folder and closed/open XCode after each of those steps, but still no luck on the Hydra import.
Note: I'm not actually using Hydra for testing, it's just a library that I've successfully used in projects in the past
This is related to a CocoaPods issue. The workaround suggested here does the trick for me. You may need to rebuild the project though.
For future reference, I've cc-ed the post:
# Moving the UITests target outside of the main target
# in the Podfile seems to have helped. So now instead of this:
target 'Target' do
use_frameworks!
...
target 'TargetTests' do
inherit! :search_paths
...
end
target 'TargetUITests' do
inherit! :search_paths
...
end
end
## we have this:
target 'Target' do
use_frameworks!
...
target 'TargetTests' do
inherit! :search_paths
...
end
end
target 'TargetUITests' do
inherit! :search_paths
... # all the pods we normally use
end
Credits to PWrzesinski
Try this:
platform :ios, '12.2'
target 'UITestProto' do
#some pods for your main target
target 'UITestProtoTests' do
inherit! :search_paths
#pods for your unit tests
end
target 'UITestProtoUITests' do
pod 'HydraAsync'
end
end
And run pod deintegrate and pod update && pod install after this.
Same behaviour still with XCode 12.3 in 2021. Easy fix for me by just running the tests once.
I had the same issue with another pod added to the unit tests or UI tests. The podfile had the pod in the right target section. So it should recognize it.
The error went away as soon as I ran the tests (Cmd+U)
Only building or running it is not enough since it won't try to build anything of the test targets.
The same problem sometimes happens when adding a new module, class etc. but also fixes itself after building the propper target.

Including a pod inside a framework target: file not found

I'm using framework targets (for better code reuse and IB_Designables), and I've already had a framework target working perfectly. I've decided to move some other classes to a framework target too.
I've set up the pods (just a single one in this case), but whenever I try to include the pod I'm getting not found error.
No change if I try to use the modules approach too:
The problem is that I've already got another framework too, with the same settings (cross checked all the compiler settings/linker flags/build phases etc) and that framework has no issue importing its pods.
Here is my podfile (TUComponents is the working on, TUModels is the failing one):
[...]
target 'TUComponents' do
pod 'AHKNavigationController'
pod 'TTTAttributedLabel'
use_frameworks!
end
target 'TUModels' do
pod 'JSONModel'
use_frameworks!
end
Even weirder; Xcode has no problem code-completing importing the JSONModel/JSONModel.h header (or JSONModel in case of module #import). But when I try to compile, it fails.
What might be wrong with my configuration?
UPDATE: If I give up using frameworks in pods and use regular old static library, and set allow non-modular includes in frameworks to YES, I can build. But I have no idea why I can't build when using Pod frameworks.
Maybe try solution from: https://www.natashatherobot.com/cocoapods-installing-same-pod-multiple-targets/
platform :ios, '9.0'
use_frameworks!
# My other pods
def testing_pods
pod 'JSONModel'
end
target 'TUComponents' do
pod 'AHKNavigationController'
pod 'TTTAttributedLabel'
testing_pods
end
target 'TUModels' do
testing_pods
end
From iOS - Build fails with CocoaPods cannot find header files :
Make sure your Podfile includes link_with on targets missing a config file. Cocoapods only sets the first target by default otherwise. e.g.
platform :osx, '10.7'
pod 'JSONKit', '~> 1.4'
link_with 'Pomo', 'Pomo Dev', 'Pomo Tests'
Restarting Xcode fixed it for me
The following steps worked in my case:
Quit the Xcode n Simulator
Delete Drived data
Again open your project
Clear it

Setting up cocoa pods with a react native project

I've set up a fresh react native project, and instantiated a cocoa pod .xcworkspace doing:
cd ios
pod init
pod install
I've then added a pod that I want to use (in this case being Buddybuild, although it doesn't really matter which pod i add, as the behavior is similar)
After I run pod install and include the header #import <BuddyBuildSDK/BuddyBuildSDK.h> in my AppDelegate.m , it is always returning me a /Users/nik/dev/myproject/ios/myproject/AppDelegate.m:14:9: 'BuddyBuildSDK/BuddyBuildSDK.h' file not found
I've battled with this all day and I have no idea why. The headers are all there in the Pods/headers/Public folder. They're being included in the header search paths in build settings as well as you can see here:
I'd highly appreciate help on this as I'm very stuck.
EDIT Also here's my Podfile:
Turns out the issue was an xcode thing. After much Googling the issue that solved it was making sure that my projects configurations were properly set. So going to Project -> Info -> Configurations And choosing the right Pods-projectName.debug and Pods-projectName.release configurations.
For RN 0.58.6 I noticed you don't need any react or react-native pods.
If you create a brand new project using react-native init (for 0.58.6) you will notice there is no need for a pod file.
My pod file looks like this:
platform :ios, '9.0'
project 'MyRNProject.xcodeproj'
install! 'cocoapods', :deterministic_uuids => false
target 'MyRNProject' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Add pods that you need here
target 'MyRNProject' do
inherit! :search_paths
# Pods for testing
end
end
In Project target Linked framework or libraries I have:
framework deps (CoreFoundation.framework, SystemConfiguration.framework Pods_MyRNProject.framework etc)
RCT and RN deps
other libs that I use

Unknown property attribute 'class' after Realm-Swift CocoaPod import

I'm new to Xcode and Swift. Today I started a blank Tabbed Application with swift called "Test". I can build the blank project but as soon as I try to add Realm via CocoaPod it doesn't build anymore.
Error: Unknown property attribute 'class'
File: Test/Pods/Realm/Realm/RLMSyncSession.mm:73:12:
CocoaPod version: 1.2.0
Xcode version: Version 7.3.1
Realm: 2.4.3
I did the pod init/update/install
PodFile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Test' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Test
pod 'RealmSwift'
target 'TestTests' do
inherit! :search_paths
# Pods for testing
end
end
After the install I opened the "Test.xcworkspace" file and tried to build the project but it fails. How to fix that?
The issue came from an outdated version of Xcode.
This causes the OP to not achieve his build and Cocoapods setup after adding Realm to his project.
After updated it to the last version (8.2.1 I suppose), as recommended in the comment, the pod mechanism worked and the build could finally be achieved.

I'm getting framework not found <library> when installing with cocoapods

I installed Google Sign In via cocoapods, but when I tried to compile got this error
ld: framework not found GoogleAppUtilities
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My Podfile is this:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'Project_name' do
pod 'PayPal-iOS-SDK'
pod 'Google/SignIn'
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Project_name
target 'Project_nameTests' do
inherit! :search_paths
# Pods for testing
end
target 'Project_nameUITests' do
inherit! :search_paths
# Pods for testing
end
end
I installed the PayPal library first without problem.
I'm using .xcworkspace
Tried cleaning and building again, using $pod deintegrate
clean the project and $pod init again and nothing seems to change.
In Xcode, look in the Pods project for a file named GoogleAppUtilities.framework. It's probably under the Pods/Products folder. You need to add a reference to this file (GoogleAppUtilities.framework) in your main project. In you main app project file go to the build settings tab and look at the list named "Link Binary with Libraries"...you need to add a reference here to the GoogleAppUtilities.framework file.
Just adding your comment as the solution: it worked for mee too:
Solved, I thank you. Your answer did not solve the issue, but It gave
me an idea. I did that and in Build
Settings->SearchPaths->FrameworkSearchPaths I added the framework in
Debug and Release.

Resources