An error during mapbox import - swift

I'm currently following this tutorial:https://www.mapbox.com/help/first-steps-ios-sdk/ and It all works up until I should use the
import Mapbox
command. Then i get an error saying:
Could not build objective-C module 'Mapbox'.
I just follow the steps and even tried it using cocoapods.

I'm using Xcode 6.4 and faced the same problem. I suppose it's caused by a too old version of Swift compiler and some 'new' Swift language features used in the latest version of Mapbox iOS SDK.
So, I just sorted through older versions of Mapbox iOS SDK using CocoaPods. The latest release version which appeared to be compatible with my old Xcode is 3.1.0.
That's my Podfile:
platform :ios, "8.0"
inhibit_all_warnings!
use_frameworks!
target "%APP%" do
pod 'Mapbox-iOS-SDK', '= 3.1.0'
end
I hope this was helpful for someone.

Related

Swift Version 5, SwiftyJSON

Build system information
error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'SwiftyJSON')
how can I deal with it?
SwiftyJSON v4.3.0 supports Swift 5. Check your Podfile to make sure youโ€™re getting the latest release. You may need to update your Pods (with pod update) to make sure youโ€™ve got the latest versions.
Also, you might consider retiring SwiftyJSON and using JSONEncoder/JSONDecoder instead. See Encoding and Decoding Custom Types or the Using JSON with Custom Types sample for more information.
If, on the other hand, you are not using Swift 5 yet, just configure your Podfile indicate that you want to use SwiftyJSON v4.2.0. E.g.
target 'MyApp' do
pod 'SwiftyJSON', '~> 4.2'
end
Either change the build target of your project to Swift 4.x or wait until the project gets support for Swift 5 (you can check that on the GitHub page)
I get this error too when i tried to pod lint or push.
error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2.
I have to stay on xcode 10.1 ans use cocoapods 1.5.3, but on a fresh install (new mac) I received the same error.
Here is my solution:
After comparing my 'gem list' with an other mac, I found that the gem xcodeproj was very high (1.12.0).
So, I installed a lower version required by cocoapods (1.5.3)
"sudo gem install xcodeproj -v 1.5.7"
and remove the never
"sudo gem uninstall xcodeproj -v 1.12.0"
Wrongs fine now, I cant lint and push my pods.

Couldn't install AudioKit 4.1

In order to install AudioKit 4.1 via CocoaPods, I did pod 'AudioKit', '~> 4.1' on Terminal, but I got an error:
[!] Unable to satisfy the following requirements:
- AudioKit (~> 4.1) required by Podfile
None of your spec sources contain a spec satisfying the dependency: AudioKit (~> 4.1).
What's wrong?
I use Swift 4 and Xcode 9.2.
This should be fixed now!
๐Ÿš€ AudioKit (4.1) successfully published
๐Ÿ“… February 13th, 17:01
๐ŸŒŽ https://cocoapods.org/pods/AudioKit
๐Ÿ‘ Tell your friends!
As for now, AudioKit 4.0.4 is the latest version that you can install directly from CocoaPods. Just remove the arrow from the dependency or replace it with ~> 4.0.4.
Alternatively, you can point the dependency to GitHub to be able to use 4.1:
pod 'AudioKit', :git => 'https://github.com/AudioKit/AudioKit.git'

Realm with Swift Error

I just created a new project and download and integrated the CocoaPods "RealmSwift". I get the following list of errors.
I have not added anything in my code. This is coming from Realm code. I am using Xcode 8 using Swift 3.0
Here is the Pod file:
If I say convert to Swift 3.0 then I get the following errors:
It seems the documentation for CocoaPods for RealmSwift may-be out of date when Xcode 8.1+ and Swift 3 is used. Step 3 is no more needed and you should skip it for this case.
i.e. you should now use (example):
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'RealmProjectAzam' do
use_frameworks!
pod 'RealmSwift'
end
Edit - addition information:
Please note, after the above question has been posted, there was some additional discussion incl. Realm and the result is that Realm (thanks #realm!) has adjusted its Swift documentation to better face the above issue. Please see the updated instructions for Cocoapods installation at realm.io
In short, to "solve" the above issue please:
Run pod repo update to make CocoaPods aware of the latest available Realm versions.

Bluemix Swift Mobile Client Access SDK when imported says no such module BMS Core and BMS Analytics show 35 errors due to which my build fails

As per the instructions given on Bluemix site; I installed the Swift SDK
pod use_frameworks!
pod 'BMSSecurity'
and it shows this on my terminal:
Then, when I built the project, I got 36 build errors.
First of which is "no such module as BMSCore" when I can see that framework imported in the pod and 35 errors related to BMSAnalytics, which is again framework imported.
These build errors are due to the incompatibility between two of the BMSSecurity dependencies (BMSCore and BMSAnalyticsAPI) and the version of Xcode you are using (7.2.1). The latest versions of these 2 frameworks only support Xcode 7.3 and higher, as explained in the BMSCore Github README. If you want to continue using Xcode 7.2, you can use BMSCore 1.0.3 instead.
So, there are 2 possible solutions here:
Upgrade Xcode to version 7.3
Add the following line to your Podfile: pod 'BMSCore', '~> 1.0.3'
Option 1 is recommended since only Xcode 7.3+ will be supported in future releases of BMSSecurity.
Are you opening FoodTracker.xcworkspace ?? please open .xcworkspace after pod install..

podspec JSQMessagesViewController non-modular header

I want to use JSQMessagesViewController as a dependency to my swift pod. When I build my example app I get the old non-modular header error related to the JSQSystemSoundPlayer but I don't know how to get around it with XCode 7.
Podspec:
s.dependency 'JSQSystemSoundPlayer'
s.dependency 'JSQMessagesViewController', '7.2.0' #Also tried 5.3.2
Errors:
This is a known issue with v7.2.0 of JSQMessagesViewController: https://github.com/jessesquires/JSQMessagesViewController/pull/1284
Check this pull-request: https://github.com/jessesquires/JSQMessagesViewController/pull/1284
Specifically, this comment from jessesquires (the author): https://github.com/jessesquires/JSQMessagesViewController/pull/1284#issuecomment-181132880
The fix will be part of v7.2.1 according to that thread.
It is not related to JSQSystemSoundPlayer.
Add this at the beginning of your Podfile:
platform :ios, '8.0'
use_frameworks!
So app will use frameworks instead of static libraries for the included projects.
Summary of changes to JSQMessagesViewController:
Change Podfile platform to iOS 8 (platform :ios, '8.0')
Change Podfile to use frameworks instead of static libraries (use_frameworks!)
Change project structure deployment target to iOS 8
Run pod install
Build & run the app
The issue is that Swift doesn't play nice with importing non-modular frameworks into frameworks. Essentially, you will only run into this problem when bundling a framework inside another. There is a simple solution, however it requires some work JSQSystemSoundPlayer as well as JSQMessagesViewController. Both projects will need to have the following Xcode project setting: DEFINES_MODULE = YES.