Can't add Mapbox and MapboxNavigation SDK - ios

In order to implement Mapbox SDK, according to official docs (https://docs.mapbox.com/ios/maps/overview/#install-the-maps-sdk,
https://docs.mapbox.com/ios/navigation/overview/), adding Mapbox-iOS-SDK and MapboxNavigation through Cocoapods, always get error, shown bellow.
I thought this is related to the usage of sourcery or SwiftGen which are the parts of project or something else, but this happened on new, clean project also, where inserting SDKs was the first step.
Cleaned derived data for few times,
remove from Podfile versioning for that SDK (pod 'Mapbox-iOS-SDK', '~> 6.0.0' as pod 'Mapbox-iOS-SDK' )
even when SDK is added through CocoaPods, can't find frameworks to add into Link Binary With Libraries
even it says Copy Bundle Resources to be checked, couldn't find what to expect there
Note:
Also tried: successfully added Mapbox and MapboxMobileEvents directly into project, but as I found MapboxNavigation SDK could be implemented only through CocoaPods or Carthage, so I'm stuck here.
I would really appreciate for someone's help, who already have faced this problem.
Multiple commands produce '/Users/x/Library/Developer/Xcode/DerivedData/mbNavigationExample-ctztmwiegsuqkigkucoydhnnoaxc/Build/Products/Debug-iphoneos/mbNavigationExample.app/Assets.car':
1) Target 'mbNavigationExample' (project 'mbNavigationExample') has compile command with input '/Users/x/Desktop/mbNavigationExample/mbNavigationExample/Assets.xcassets'
2) That command depends on command in Target 'mbNavigationExample' (project 'mbNavigationExample'): script phase “[CP] Copy Pods Resources”

Related

Adding Framework to Swift Project

I am trying to use the SwiftIconFont Framework in my project. I followed all the directions listed. I added pod 'SwiftIconFont', '~> 2.7' then performed pod install. The terminal spits out:
Analyzing dependencies
Downloading dependencies
...
...
Installing SwiftIconFont (2.7.0)
...
...
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 8 dependencies from the Podfile and 13 total pods installed.
Judging from this terminal message, SwiftIconFont should have been successfully installed on my project. However, when I go to my project to try to link the SwiftIconFont framework, the added directory appears to be empty.
I tried to import SwiftIconFont but Xcode says no such module exists. What else should I do to be able to use this framework?
I also added github "0x73/SwiftIconFont" to my Cartfile, then performed carthage update, even though this step may be unnecessary.
I'm not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.

Framework not found GoogleMapsCore

I am using the Google Maps framework in my iOS app. But I cant seem to understand what is causing the error: Framework not found GoogleMapsCore.
Yes I know that it can't find that module. But I can see it in the Pods folder. See the image below.
I even added the link to that folder in the Framework Search Path.. see image below.
Do you have any idea?
Generally, this is an indication that the Pods projects is not properly built. The best way to solve this is to remove the GoogleMaps pods from your Podfile, run pod install. This will remove the GoogleMaps Framework. Then edit the Podfile again, add the GoogleMaps framework and run pod install again. This will reinstall the pods, and regenerate the Pods Project linking all your frameworks properly to your app. It almost always works for this error - Framework not found.
A good place to start would be those red files. See all those red filenames? They are missing from the project. You need to build them.
Look up cocoapods and follow the instructions to create your workspace file. [it's just one simple install command]
Always from now on, when working on this project, instead of
ProjectName.xcodeproj (blue avatar) you should double-click on the ProjectName.xcworkspace (white avatar) file. That will open the project in Xcode. And the filenames should no longer be red.
I had the same problem. For me I needed to remove armv7s from the valid Architectures. I guess GoogleMaps (2.3.1), which is what I am using, does not build against that architecture.
Delete your PODS folder, and run pod install again.

Parse SDK / CocoaPods

I have an objective C iOS app using the Parse SDK.
In the process of moving this app from Parse.com to a self hosted Parse-Server, I need to update the Parse SDK to the latest version. For this update I decided to go with CocoaPods.
This is the first time I touch CocoaPods (after reading and hearing so much good about it).
I found my way, following what I could read here and also based on a few CocoaPods tutorial I quickly viewed.
Having my project "ready", when buiding it I get this error:
#import <ParseUI/ParseUI.h> -----> File not found.
Obviously things have changed place. And I tried a couple of unsuccessful solutions.
So here is my question:
How do I need to change the settings of my project, now that I am using CocoaPods?
In order to use Cocoapods with parse and Parse UI you need to do the following steps:
Create a new file and name it Podfile. This file should be located on your IOS project root folder.
The Podfile should contain at least the following structure if you want to use parse IOS SDK and ParseUI
platform :ios, '8.0'
use_frameworks!
pod 'Parse'
pod 'ParseUI'
# Put more pods in here..
Notice to the platform, you may change it to the minimum version that your app can run on and the use_frameworks! will install all your pod as frameworks and this is mandatory if you like to consume Swift libraries.
Open terminal and navigate to your IOS root directory and enter pod install. This command will install all the pods and dependencies into your project.
After installing you will no longer use the IOS project file from now on you will use a new file which called workspace. The workspace will contain both your project files and the pods project/frameworks files.
Build your project, fix some error (if there are) and run it to make sure that it works as expected .
More CocoaPods commands that you need to know are:
pod update - update all your pods to the latest release or to the release that was mentioned in the Podfile
pod update update specific pod to the latest release or to the release that was mentioned in the Podfile
pod outdated - display out to date pods that are being used inside your project.

How to manually import third party Swift framework into Swift iOS project?

I am trying to import and use the OAuthSwift library in the Swift iOS project. I followed their directions:
Drag OAuthSwift.xcodeproj to your project in the Project Navigator.
Select your project and then your app target. Open the Build Phases panel.
Expand the Target Dependencies group, and add OAuthSwift framework.
import OAuthSwift whenever you want to use OAuthSwift.
After completing these steps, importing OAuthSwift using import OAuthSwift causes the error No such module 'OAuthSwift' and the project fails to build.
I have tried the following steps, based on a number of other SO questions about similar issues:
Clean and rebuild
Add the OAuthSwift framework to many different combinations of Build Phases > Target Dependencies, Build Phases > Link Binary With Libraries, Build Phases > Embed Frameworks, and General > Embedded Libraries
Set Build Settings > Search Paths > Framework Search Paths and Build Settings > Search Paths > Library Search Paths to $(SRCROOT) and recursive.
Verify that my deployment target matches the deployment target of the OAuthSwift Xcode project.
I have tested this using the latest version of OAuthSwift from their master branch using a git submodule, as well as manually downloading and importing each of the two latest tagged versions (0.6.0 and 0.5.2).
I have also created a brand new Xcode project, imported OAuthSwift as above, and encountered the same error.
Finally, I also tried importing a different Swift Framework (Alamofire), following the steps as stated on the README at https://github.com/Alamofire/Alamofire. This caused the same error as well: No such module 'Alamofire'.
I am using:
OSX 10.11.6
Xcode 7.3.1
Swift 2.2
I'm still fairly new to Xcode and the Swift module system, so any help or suggestions is appreciated.
Your life will be a lot easier if you import the framework using CocoaPods. If you haven't used them before, it's really easy once you get set-up. You use Ruby Gems on the command line to install CocoaPods (sudo gem install cocoapods) and then create a create a pod file using pod init. After this you modify it to include:
platform :ios, '8.0'
use_frameworks!
pod 'OAuthSwift', '~> 0.5.0'
Save the file and run pod install.
Once this is complete you will have to close out the Xcode project and use the newly created .xcworkspace project file (not the .xcodeproj) from here forward.
Here is a link to another post for a secondary reference.
How to install cocoapods?

Cocoapods "use_frameworks!" with Google Analytics and Swift libraries

I've been using use_frameworks! directive so that I can use some dependencies on my project. If I comment that directive, I get a red message saying
Pods written in Swift can only be integrated as frameworks; this feature is beta. Add 'use_frameworks!' to your Podfile or target to opt into using it.
Today I decided to use Google Analytics for iOS but when running $pod install I get
The 'Pods-MyProject' target has transitive dependencies that include static binaries
Googling around I found out it is caused because of the use_frameworks! directive and I should remove it. So I'm between a wall and a sword, what can I do to be able to work with these libraries?
PS: We are required to manage dependencies using Cocoapods, so including it in a different way is not an option. Also, I don't have a bridging header in my project, but I'm still able to work with libraries using import MyDependency

Resources