I wanted to write some unit tests using GRUnit & OCMock for an app using Realm. Even though the pods are installed and the paths should be correctly set, Xcode can't seem to find a number of files like RLMAccessor.h.
I get an "lexical or preprocessor issue"
I've tried a bunch of things like removing realm, downgrading, updating cocoapods, clearing the cache, adding the libraries and so on but nothing
seemed to work.
Anyone been able to set up Realm to work with GRUnit?
EDIT this how my pod file's set up. I'm using cocoapods but including real/headers didn't work for my test target.
target: myApp do
pod 'Realm' , '~> 0.92.2'
pod 'Localytics', '~> 3.1.1'
end
target :test do
shared_pods
pod 'Realm/Headers'
pod 'GRUnit', '~> 1.0.1'
pod 'OCMock', '~> 3.2.1'
end
Using Realm 0.92.2, Xcode 6.3.1
So I fixed it by upgrading to a newer GRUnit version then downgrading agin because GRUnit didn't work anymore and removing pod 'Realm/Headers' with pod 'Realm' and ran pod install again.
Related
I'm trying to install an objective-c Wrapper for Jsip 'VialerSIPLib' and use it in my swift project here is my pod
platform :ios, ’10.0’
use_frameworks!
target 'EMedicalAdmin' do
pod 'ObjectMapper', '~> 2.1'
pod 'Alamofire', '~> 4.3'
pod 'SwiftyAvatar', '~> 1.0'
pod 'AlamofireImage', '~> 3.1'
pod 'Eureka', '~> 2.0.0-beta.1'
pod 'JSQMessagesViewController', :git => 'https://github.com/jessesquires/JSQMessagesViewController.git', :branch => 'develop'
pod 'PKHUD', '~> 4.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'ImageSlideshow', '~> 1.1.0'
pod 'SwiftyJSON'
pod "FlexibleSteppedProgressBar"
pod 'BTNavigationDropdownMenu', :git => 'https://github.com/PhamBaTho/BTNavigationDropdownMenu.git', :branch => 'swift-3.0'
pod 'VialerSIPLib'
end
but i get this error when installing :-
target has transitive dependencies that include static binaries:
and if i remove
use_frameworks!
from my podfile it would work but all my other swift based pods won't work
so, i'm left with using only this one pod (VialerSIPLib) or Use all my other pods except it
Please add this to your podspec: s.static_framework = true
This is available from cocoapods version 1.4.0.
It worked for me.!!
use_frameworks! should be enough but sometimes the pod.lock file gets corrupted.
So you can delete the pod.lock file and then do
pod repo update and pod install
if any one is Still wondring ,it can't be Done
Using dynamic vendored frameworks shouldn't be a problem even if the
developer isn't using CocoaPods with use_frameworks!, unless they for
some reason need a static lib, such as if building a command line
tool, where static linking is preferable.
So .You Could add the static library manually and link it in you project or wait for the vendor to Change the library into a dynamic Framework
More info here
For me this is how i solved it :-
1- Downloaded the static library using Cocoapods without use_frameworks!
2- used Carthage for Adding other libraries
3- and if a library Doesn't have a Carthage support i would do it manually (Not advised since alot of Duplicate dependencies may Appear)
I put up a repo to show how to do: https://github.com/Lucashuang0802/CocoaPodsWithCarthage
There are a couple things to do:
- install your objective-c lib via CocoaPods without indicating use_framework! in the Podfile
- install your pure Swift module via Carthage
You should be able to compile fine with this solution.
It's a weird one.
For me uninstalling and installing again worked.
Steps -
Comment(#) the error causing pod in pod file
Pod install
Uncomment the line in pod file and save
Pod install
I'm very new on Mac / iOS development with Xcode and I have trouble on building my App. I work since 4 days on that issue, but I have no more ideas to find the reason.
The App has 6 projects, bundled in a xcworkspace. I added via cocoapods and via terminal with command pod install RxSwift, RxCocoa, OMGHTTPURLRQ, PromiseKit and SVWebViewController successfully. The projects without dependencies could build successfully. Two projects (libraries) with command "import RxCocoa" and "import RxSwift" in *.swift files are failed with error "No such module 'RxCocoa'".
I read some Stackoverflow posts and the RxSwift Git documentation to solve the issue, without success.
Screenshot of build error and added reference
Podfile definition:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.1'
use_frameworks!
target 'CheckMyBus' do
pod "OMGHTTPURLRQ", "~> 3.1.2“
pod "RxSwift", "~> 2.3.0"
pod 'RxCocoa', '~> 2.3.0'
pod 'PromiseKit', '~> 3.2.1'
pod 'SVWebViewController', '~> 0.2‘
end
Pods installation via terminal:
MacMinis-Mac-mini:CheckMyBus MacMini$ pod install
Analyzing dependencies
Downloading dependencies
Using OMGHTTPURLRQ (3.1.3)
Using PromiseKit (3.2.1)
Using RxCocoa (2.3.1)
Using RxSwift (2.3.1)
Using SVWebViewController (0.2)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 5 dependencies from the Podfile and 5 total pods installed.
[!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.
[!] The `CheckMyBus [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-CheckMyBus/Pods-CheckMyBus.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `CheckMyBus [Release]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-CheckMyBus/Pods-CheckMyBus.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
MacMinis-Mac-mini:CheckMyBus MacMini$
Can anybody help me?
I solved the issue. The solution was so simple, but I had previously found no documentation to use pods with several libraries.
I forgot to add pods definitions in the Podfile for the libraries.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.1'
workspace 'MyWorkspace'
use_frameworks!
target 'MainProj' do
pod "OMGHTTPURLRQ", "~> 3.1.2“
pod "RxSwift", "~> 2.3.0"
pod 'RxCocoa', '~> 2.3.0'
pod 'PromiseKit', '~> 3.2.1'
pod 'SVWebViewController', '~> 0.2‘
project 'MainProj'
end
target 'Lib1' do
pod "RxSwift", "~> 2.3.0"
pod 'RxCocoa', '~> 2.3.0'
project 'Lib1/Lib1.xcodeproj'
end
target 'Lib2' do
pod "OMGHTTPURLRQ", "~> 3.1.2“
pod "RxSwift", "~> 2.3.0"
pod 'RxCocoa', '~> 2.3.0'
project 'Lib2/Lib2.xcodeproj'
end
Note: Build works, but not Test! Explanation: CocoaPods Podfile config issue. The given pod/framework is specified for the non test main target, maybe even for the (unit) Test target, but not for the UI Test target! E.g.: platform :ios, '9.0' use_frameworks! target 'Xyz' do pod 'MessageK…
I tried installing a new pod file for my project and keep getting an error in my Terminal. Everything was working fine before I went to add a new pod to my project. Attached are screenshots of my directory, pod file with TextEdit and TextWrangler, as well as the Terminal. I realized I needed Alamofire, instead of AFNetworking. So I deleted AFNetworking out of my profile to replace it with Alamofire. I still get the same error when I had AFNetworking though in the file and just added Alamofire. What do I do?
Change the target name to Thrill. So target 'Thrill' do.
Update your podfile to this instead:
platform :ios, '9.0'
use_frameworks!
target 'Thirll' do
pod 'Stripe', '~> 4.0',
pod 'Alamofire', '~> 4.0'
end
I figured it out. I think I had to update ruby. I basically reinstalled everything again and created a new pod file, even though there was already a pod file. Thanks guys!
I ran pod update and two libraries were updated. I then opened xcode and tried to build and run the application but the libraries that were updated both failed to build, one gave 65 compile errors and the other gave 27.
I have tried
Updaing cocoapods to the latest version but it made no difference
pod cache clean --all, also no difference
Confirmed ONLY_ACTIVE_ARCH is set the same in the pods and my app (both set to yet)
Reverting to the pervious versions of the libraries, still have compile errors despite them being in use for months before this without a problem
The libraries not compiling are SwiftyJSON and Kingfisher.
Here is a sample of the errors being produced, the selected error in the left pane is the top error in the right pane.
What other issues could be causing this problem?
Edit: The pod file
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Starscream', '~> 0.9.3'
pod 'Kingfisher', '~> 1.5'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :branch => 'master'
So I dont actually have a solution as to what was causing this but updating to Xcode 7 fixed it.
We're having some issues integrating CocoaPods in the Calabash target.
At the moment we have 4 targets:
App: normal app target
AppTests: unit tests target
App-Calabash: calabash target
App-API-Stubs: special target
We want to share all the Pods between App, App-Calabash and App-API-Stubs.
Also, AppTests and App-Calabash have to include other libraries.
This is our Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
link_with 'App', 'App-Calabash', 'App-API-Stubs'
inhibit_all_warnings!
pod 'MagicalRecord', '~> 2.2'
pod 'AFNetworking', '~> 2.3.1'
pod 'ObjectiveSugar', '~> 1.1.0'
pod 'KZPropertyMapper', '~> 2.5.0'
pod 'FXBlurView', '~> 1.6.2'
pod 'OHHTTPStubs', '~> 3.1.5'
pod 'Google-Maps-iOS-SDK', '~> 1.8.1'
pod 'KVOController', '~> 1.0.1'
pod 'Braintree', '~> 3.3.1'
pod 'TTTAttributedLabel', '~> 1.10.1'
pod 'ObjectiveLuhn', '~> 1.0.0'
pod 'CrashlyticsFramework', '~> 2.2.1'
target 'App-Calabash', :exclusive => true do
pod 'Calabash', '~> 0.9.169'
end
target 'AppTests', :exclusive => true do
pod 'Specta', '~> 0.2.1'
pod 'Expecta', '~> 0.3.0'
pod 'OCMock', '~> 3.1.1'
end
All the targets build and run just fine but the Calabash one.
It complains it can't find Crashlytics/Crashlytics.h. But even if we temporary avoid to use Crashlytics, it then complains about the Calabash library during the linking:
ld: warning: directory not found for option '-L/Users/Marco/ios/App/Pods/build/Debug-iphoneos'
ld: file not found: -lPods-App-Calabash-Calabash
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So it would seem something is gone terribly wrong integrating pods into that specific target.
I'm pretty sure I'm missing something simple but I can't figure it out.
Any help is really appreciated. Thanks!
Took me all morning looking for a solution for this. I have found the answer here http://flexpletives.blogspot.com.es/2014/02/ios7-tdd-w-ocmock-and-xcode5.html
Go to your Calabash target -> Build settings -> Other linker flags
Remove "-force_load"
Add "-all_load"
By specifying exclusive for the App-Calabash target in your Podfile you're saying that you only want to link the Calabash framework and not the others which is why Crashlytics won't be found.
target 'App-Calabash', :exclusive => true do
pod 'Calabash', '~> 0.9.169'
end
I set Calabash up today using Cocoapods and here's how I got things to work:
1.) Add a new configuration to your project named Calabash or similar (from the Info panel of Project settings).
2.) Update your Podfile with the following line:
pod 'Calabash', :configurations => ['Calabash']
3.) Run pod update from the command line.
4.) Under the Pods project, in Targets Support Files you should find a file called Pods.calabash.xcconfig. Drag (but don't select the 'copy if needed' option) this file to the Pods group in your main project alongside Pods.debug.xcconfig and Pods.release.xcconfig.
5.) In your main project navigate to the Info panel of project settings and expand the Calabash configuration you created in step 1. Your main project's target configuration will be set to Pods.debug or Pods.release. Set it to Pods.calabash.
6.) Create a new scheme called Calabash and edit it. Select the 'Run' phase and in the Info pane select the Calabash build configuration from the drop-down.
7.) In order to run Calabash, select the newly created Calabash scheme and run.
Hope this information helps.
The following answer helped me resolve an issue nearly identical to this.
https://stackoverflow.com/a/27039447/1004227
In short, I had to set the Configurations to None for all relevant targets of the Calabash scheme. Then run pod install and let Cocoapods reset the Configuration to a Pods.calabash configuration.