MetaWear : Unable to build Cocoapod used in IOS application - ios

I am attempting to use the MetaWear cocoapod to connect to BLE sensors from my IOS application. Before adding this pod, I created a basic Single View Application in Xcode. I tried to compile and run it on my iPhone, and it showed up as expected.
Having done this, I did a pod init, and updated my Podfile to look as follows, as recommended in the above MetaWear cocoapod link:
platform :ios, '12.2'
target 'myProj' do
use_frameworks!
pod 'MetaWear', '~> 3.2'
end
Once I run "pod install", I get the following output:
Analyzing dependencies
Downloading dependencies
Using Bolts-Swift (1.4.0)
Using MetaWear (3.2.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.
I then open my Xcode project ( myApp.xcworkspace ), and when I try to re-build the project, I keep getting this error:
Could not build Objective-C module 'BoltsSwift'
This is also shown in the following image:
As a result, I was under the impression that maybe I should downgrade the BoltsSwift version, but specifying something lower than 1.4, seems to be ignored. For example, I added this pod:
pod 'Bolts-Swift', '~> 1.3'
And my output after running pod install, still yielded "Using Bolts-Swift (1.4.0)". So I am not too sure how to get rid of this compilation failure. Maybe downgrading BoltsSwift is not the correct course of action. What can I try? (I am using Xcode Version 10.2.1 (10E1001))

Ok, turns out that by default, XCode set my Swift compilation to 5.0 for the BoltsSwift and MetaWear pod. I changed it to Swift 4, and I was able to build.
Updating the pods compilation level might also be a good idea, as described here :
How to set the Legacy Swift Version for each Pod in Podfile Xcode 9.0 Swift 3.2 / Swift 4.0

Related

Audiokit 4.5.2 - can't install via cocoa pods in Terminal

My app's deployment target is currently set to 9.2 in Xcode. I believe 9.0 should be minimum.
However when trying to update to AudioKit 4.5.2 (from 4.4) - I'm getting the following error in Terminal...
⇒ pod install
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "AudioKit":
In Podfile:
AudioKit (~> 4.5.2)
Specs satisfying the `AudioKit (~> 4.5.2)` dependency were found,
but they required a higher minimum deployment target.
What should I do? Many thanks.
The answer to your question has already been given to you.
Specs satisfying the AudioKit (~> 4.5.2) dependency were found, but
they required a higher minimum deployment target.
This literally means you're trying to update to v4.5.2 but that specific version requires a higher minimum deployment target, should be higher than your iOS 9.2.
What should I do? Many thanks.
You have multiple options:
Target iOS 10 (or at least the v4.5.2's deployment target), if that's okay with your manager or team lead, or you.
Explicitly target AudioKit's lower version, like what you've mentioned, in your podfile, like so: pod 'AudioKit', '4.4'.
UPDATE:
I made a sample Xcode project and discovered that they haven't released v4.5.2 for their cocoapods, well, as far as I know. So this should be in your podfile insted:
pod 'AudioKit', '~> 4.0'
and make sure that you also have this line in your podfile, targeting your iOS version:
platform :ios, '10.0'
I hope this helps!

Swift iOS project won't compile if I add any CocoaPod library

I'm new to iOS and am working on an app in Swift. I'd like to use CocoaPods for dependency management, but I am having issues. I've been able to install CocoaPods on my Mac, run pod init to create my pod file, and run pod install to install dependencies just fine. The .xcworkspace file was installed and I've been using it with my project.
My problem comes where after I add any pods to my pod file and run pod install, then go to build my app, there are errors with the pod files that get installed and the project wont build. I've tried a lot of different pods and all have similar errors. My guess is that the errors are related to the Swift version, but I'm not familiar enough with the tools to know how to adjust it.
The project will build fine if I remove the pods from the podfile and run a pod install again.
The errors are all over the files and are things like:
Expected declaration
Consecutive declarations on a line must be separated by ';'
Expected '{' after operator name in operator declaration
My environment specs
pod --version = 1.1.1
XCode Version = 8.2 beta (although I'm seeing the same issues on 8.1)
My podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'MySampleApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MySampleApp
pod 'Marshal', '~> 1.0'
pod 'FontAwesomeKit', '~> 2.2'
end
Also, the app I'm using is the starter sample app from AWS Mobile Hub. Everything works fine until I add a pod.
Any help would be much appreciated. I just don't know where to go from here.
I've found my problem. The Marshal library I was trying to use was not Swift 2.3 compatible (it was build for Swift 3). The AWS Mobile Hub sample app was using Swift 2.3, so I couldn't compile the two together. I decided to use a different library to parse JSON (pod 'SwiftyJSON', '2.4.0') and my app is building fine.

Pod update has fatally altered app

My perfectly working app used to have an Xcode Project Navigator as shown below.
iOS 10 requirements meant I had to upgrade Xcode to 8.1, which meant upgrading the entire Mac OS to Sierra and also translating the whole app to Swift 2.3.
Needless to say, this caused errors, one of which was an issue with PubNub. However, apart from this new build error the app structure was the same and everything seemed ok after dealing with all the layout issues.
I was requested to run the following steps to try to solve the PubNub pod error despite me warning that previous attempts to deal with the pod file caused fatal errors that were ultimately unrecoverable.
Install all iOS simulators after Xcode update
Open Xcode preferences (Cmd+,) and navigate to ”Locations” tab where will be shown path to ”DerivedData” folder
Click on small circle with arrow on the right side of shown ”DerivedData” path to open it in Finder
Quit Xcode
Remove ”DerivedData” folder
Clean up CocoaPods (if integrated with it) caches by entering this in Terminal:
rm -rf ~/Library/Caches/CocoaPods
From project root (where Podfile is located) run this in Terminal:
pod deintegrate MyApp.xcodeproj
Remove from project root (where Podfile is located) Podfile.lock file
From project root (where Podfile is located) run this in Terminal: pod update
Launch Xcode (hit Shift + Cmd + K just in case)
Try build project
After doing all this my Project Navigator now looks like this.
As you can see, I've lost a load of stuff including the pod file etc. As suspected, my app is now fatally wounded.
My bridging header is red, Restkit.h is red and all pod references gone.
My project root in Finder has the Pods folder and pod file etc, however if I try to drag folders into the project from Finder they do not show as they used to - e.g., folders are blue color not yellow.
I'm on Xcode 8.1 and Cocoapods 1.1.1.
How can I recover my app?
EDIT: If it helps, here is the link to my unsolved question in January which was the last time I dared touch the pod file at all until now. The consequences of this situation are the same as before - the difference is that in January I was ditching 2 weeks work, now I'm looking at ditching 10 months' work.
RestKit.h never found in Xcode project
Podfile:
pod 'RestKit', '~> 0.24.0'
pod 'SimpleKeychain'
pod 'AWSS3'
pod 'VideoCore'
pod 'SDWebImage', '~>3.7'
pod 'SVPullToRefresh'
pod 'PubNub', '~> 3.7.11'
pod 'MZFormSheetController'
Result of pod update in Terminal:
Update all pods
Updating local specs repositories
Performing a deep fetch of the master specs repo to improve future performance
warning: inexact rename detection was skipped due to too many files.
CocoaPods 1.2.0.beta.1 is available.
To update use: sudo gem install cocoapods --pre
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.0.beta.1
Analyzing dependencies
[!] The dependency RestKit (~> 0.24.0) is not used in any concrete target.
The dependency SimpleKeychain is not used in any concrete target.
The dependency AWSS3 is not used in any concrete target.
The dependency VideoCore is not used in any concrete target.
The dependency SDWebImage (~> 3.7) is not used in any concrete target.
The dependency SVPullToRefresh is not used in any concrete target.
The dependency PubNub (~> 3.7.11) is not used in any concrete target.
The dependency MZFormSheetController is not used in any concrete target.
From the pod update logs seems like CocoaPods can't find any target where the libraries have to be applied.
Can you try something like this in your Podfile?
target 'YOUR_TARGET_NAME' do
pod 'RestKit', '~> 0.24.0'
pod 'SimpleKeychain'
pod 'AWSS3'
pod 'VideoCore'
pod 'SDWebImage', '~>3.7'
pod 'SVPullToRefresh'
pod 'PubNub', '~> 3.7.11'
pod 'MZFormSheetController'
end
Not sure if it will fix the error you have.

Does Facebook SDK support Swift 2.3/3.0?

Ok, I can't figure out what's the catch here. I follow all the instructions to configure my new project using CocoaPods to use Facebook SDK. Once I open generated project workspace, Xcode offers me to convert some source code in Pods project to Swift 2.3 or Swift 3.0.
I tried twice - with converting to Swift 3.0 and converting to Swift 2.3. Neither works and both give me on average ~120 compilation-time errors.
What's the deal here? I can't find anyone with similar problems. They seem to support Swift 2.3, but it doesn't work actually.
Xcode 8.0, Deployment target 8.0, latest FB sdk available through pods - 4.16.1
Facebook version 0.2.0 has support for Swift 3.0. Make sure you do the following before installing the latest version of Facebook SDK:
1: Get the latest version of Cocapods:
gem install cocoapods
(or if the above fails)
sudo gem install cocoapods
2: Update your local specs repo by running:
pod repo update
3: And then update your pod file and run pod update or pod install
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
I think your probably missing step 1.

Alamofire won't build in empty Swift project using Cocoapods

I am starting a project by creating a blank Single-View app for Swift. Using Cocoapods, I am adding Alamofire as follows:
platform :ios, "8.0"
use_frameworks!
target 'TestGauge' do
pod 'Alamofire', '~> 3.0'
end
target 'TestGaugeTests' do
end
Then, in Terminal I run pod install
When returning to XCode, the project fails to build with 1000+ errors generated from Alamofire.
I am running XCode from the workspace file and NOT the project file.
XCode version 6.4
Has anyone had this behavior, or can anyone offer a solution? Have I missed a critical step?
Thanks!
Alamofire 3.0 is written in Swift 2.0. Xcode 6.4 does not support Swift 2.0. Change Alamofire version or update your Xcode.

Resources