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

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.

Related

Xcode 10.1: Pods not compiling when running UITest

I am trying to implement UITests in an application I'm working on.
When I am in my UITests.swift file and I try to run the app from a test, Xcode gives the following error for some of the pods I'm using:
Command CompileSwift failed with a nonzero exit code
It gives this error for a bunch of pods that are compiling just fine when running the regular project:
My PodFile looks as follows:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
source 'https://github.com/cocoapods/specs.git'
project 'Project.xcodeproj'
use_frameworks!
# Define all thirdparty pods we need
def thirdparty
pod 'Moya', '~> 11.0'
pod 'Alamofire'
pod 'SwiftyJSON'
pod 'Differ'
.. a bunch of other pods
end
# Pods for Project project
target 'Project' do
thirdparty
end
# Pods for ProjectTests
target 'ProjectUITests' do
thirdparty
pod 'Nimble'
end
I'm having a hard time reasoning why this is happening, as my project normally compiles just fine. Other posts on S.O. regarding this problem report that the problem also occurs when building the project rather than just running for a test
Question How can I make sure that all pods I use in my project, also compile correctly when building from a UITest?
How can I make sure that all pods I use in my project, also compile correctly when building from a UITest?
The only way to know whether something will build or not is to try to build it. So when you change your CocoaPods configuration, even if that's just to update to a newer version of one or more pods, you need to try building each target.
target 'ProjectUITests' do
thirdparty
pod 'Nimble'
end`
According to your Podfile, you've got the pod Nimble being used only in the ProjectUITests target. If that's the only target that fills to build, then it seems likely that that pod is the culprit.
Except for one case (at least as far as you've shown) your Podfile doesn't specify versions for the various pods that it specifies. If you leave out the version for a given pod, your project will use the latest available version. That means that anytime you update your pods you'll pull down the latest version, even if that new version contains breaking changes. It would be safer to specify the version that you know works, or at least to limit the version to minor version and patch updates, like:
pod 'Nimble', '~>7.0'
That will let CocoaPods automatically use the latest version up to but not including 8.0. If the pod developer properly follows the semantic versioning scheme, that should ensure that you don't inadvertently pull in any breaking changes.
The problem is that target :AppModuleTests do do not have an app host and you are using inherit! :search_paths. This means that this target would find the dependencies to load them from the host but in this case there is none.
target TestApp do
pods
target :AppModuleTests
end
This worked for me.

Unable to Install cocoaPods in already existing Xcode project

I do have an existing project in Xcode (swift 3) in which a detailed UI has been designed. I am still unable to install CocoaPods into that project.
All the guides I've seen on how to install cocoa pods people CREATE A NEW PROJECT and install it in that NEW PROJECT, however, I want to install it in an existing (designed UI) project. Trying to install cocoa pods in that project lead me to a workspace that shows everything empty and red lines everywhere on the left see the screenshot and suggest a solution, please. Thanks!
Please follow the below steps for installing pods to an existing project:
Open Terminal and navigate to the directory that contains your project by using the cd command:
cd ~/Path/To/Folder/Containing/Project
Next, enter the following command:
pod init
This creates a Podfile for your project.
Finally, type the following command to open the Podfile using Xcode for editing:
open -e podfile
It opens the podfile for you.
Now edit podfile to add required frameworks. it should look similar to below snippet.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectTarget' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Firebase/Messaging'
# Pods for ProjectTarget
target 'ProjectTarget-iOSSDKTests' do
inherit! :search_paths
# Pods for testing
end
target 'ProjectTarget-iOSSDKUITests' do
inherit! :search_paths
# Pods for testing
end
end
Then after pods will be integrated to the project and .xcworkspace will be created.
Next time open the .xcworkspace to continue with the project.

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

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

Getting started with Firebase, iOS and Swift

Perhaps this is a n00b question but I'm going to ask it anyways. I followed the instructions for adding Firebase to a Swift app via CocoaPods. Everything seems to have worked fine. Here is my Podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'FirebaseDemo2' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for FirebaseDemo2
pod 'Firebase'
end
When trying to import the Firebase module into the AppDelegate, at first Xcode complains it cannot find it but the project builds just fine. However, when trying to add the FIRApp it then fails to build because it cannot find the class.
The Podfile is in the same directory as the .xcodeproj and I am opening the .xcworkspace file in Xcode. This is really confusing me. Can someone see what I am doing wrong? Is CocoaPods misconfigured?
I had the same problem, it installed 2.5.1 but you need 3.2.0
Try running
pod update Firebase
You should now have Firebase 3.2.0
I think your Podfile should look like this:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
use_frameworks!
target 'FirebaseDemo2' do
pod 'Firebase'
end
Make sure to open the Xcodeworkspace and not the Project

IOS Run custom shell script 'embed pods framework' file not found error

I am getting an error when building my app after i removed reference to a framework i added incorrectly. i am new to ios and cocoapods
/Users/MyMac/Library/Developer/Xcode/DerivedData/MyApp-ewxrexwuczochyctnqvlyusrtvvy/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Script-5874133373474758EEC76CFD.sh: line 2: /Users/MyMac/Documents/MyApp/Pods/Target Support Files/Pods-MyApp/Pods-MyApp-frameworks.sh: No such file or directory
I am aware that the file and directory don't exist and that is the way it should be but where is it finding the reference to this file so i can remove it and be rid of the error.
I have checked the following:
Linked Frameworks andLibraries under the general tab of my project
The frameworks group in the project
framework search paths under build settings tab
i have also run pod update after removing it from the pod file
How can i fix this?
Edit
back story
I was trying to add the framework https://github.com/Alliants/ALAccordion . in the instruction it said to use
# Podfile
target 'My Target' do
use_frameworks!
pod "ALAccordion"
end
so i added MyApp where my Target is and it created a framework named Pods-MyApp which i cant remove completely.
hope this helps
Cocoapods wrote a tool to completely deintegrate all of this stuff from your project so it goes back to running standalone. It sounds like you had an issue adding the correct target, so use this:
https://github.com/CocoaPods/cocoapods-deintegrate
Then try again so you can at least start from good ground. Hope this helps!
It happened with a prerelease version of Cocoapods 1.2.0.beta.1, by reverting to stable version and running pod install, then clean build, it worked.
why
use_frameworks!
after
target ... do
here is example
platform :ios, '8.0'
use_frameworks!
inhibit_all_warnings!
target 'XXX' do
pod 'RealmSwift'
end
target 'XXXTests' do
pod 'RealmSwift'
end

Resources