Using Google Maps SDK with Parse.com Project iOS Swift - ios

Im working on a project (xcode 6.3+, swift) using Parse SDK (parse.com) to handle data.
Recently, we decided to use the google maps sdk to provide user with directions using the direction API. As you can use this API without the google map I started integrating it. It's my first time with cocoapods so I followed the instruction and started playing with.
pod init to create the pod specs file
here is my config coming from google Starting Guide
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'GoogleMaps'
pod install, then launching the project using the .xworkspace
I directly try to build the project and it returns 34 errors.
the type of error is always the same: Apple Match-O Linker Error
So I start looking at google cause I did the same thing on a blank project and everything was working really good.
I start to find information about the fact that using Parse SDK causes conflicts with the -ObjC linker Flags that GoogleMaps needs to work. most of the answers give two potential solutions:
1. addind the Facebook-iOS-SDK framework
tried this using the framework given by facebook, as well as using cocoapods. not working. I still got errors.
2. Force Loading the GoogleMaps framework by replacing the -ObjC flag by the following
-force_load $(PROJECT_DIR)/Pods/GoogleMaps/Frameworks/GoogleMaps.framework
this returns an error as well:
so now Im quite lost about the way to solve this. Is there anybody that found a way to integrate GoogleMaps SDK with Parse?
UPDATE
I tried a different approach by injecting GoogleMaps without cocoapods. To do this I used this method: GoogleMaps without CocoaPods
It seems to integrate itself properly, but the -ObjC flag remains. Using
-force_load $(PROJECT_DIR)/GoogleMaps.framework/GoogleMaps
is now responding but causing duplicate symbols for architecture x86_64errors.
can't seems to find a way to fix that.

You need to do this
Click on your project (targets)
Click on Build Settings
Under Framework search paths (set your framework path)
Following information for getting framework search paths
Right click on your framework folder (for ex: GoogleMaps.framework)
select Get info
copy the path from General->where and paste this path in your framework search path (path should contain in single line)
Good luck

Ok so I managed to find working solution both for integrating GoogleMaps Sdk and Parse with and without cocoapods. However, the use of the -ObjC flags by GoogleMaps forced me to integrate the FacebookSDK to the equation. I couldn't find a way to make this working without it
So this config is working with xcode 6.3+ and it required to use and older version of the Facebook SDK (when not using cocoapods)
With CocoaPods
1/. Add the Parse SDK as described on their website (existing project version)
2/. Add extra Frameworks (AdSupport, Account and Social) as well as libstdc++.6.dylib
3/. Open terminal to the root folder
4/. $ pod init
5/. open Podfile and replace content with the following:
use_frameworks!
platform :ios, ‘8.0’
pod 'GoogleMaps'
6/. $ pod install then $ pod update
7/. download FacebookSDK from this link
8/. Add FBSDKCoreKit and FBSDKLoginKit Frameworks to your project
9/. build your project.
If some error occurs, you may have to delete ParseFacebookUtils.framework from your project and keep only ParseFacebookUtilsV4.
Without CocoaPods
So this is quite the same procedure except that instead of using pods to install GoogleMaps SDK, you will integrate it manually by using the link mentionned in the question, or by going to GoogleMaps podspecs and access the source url to download the last one.
Make sure to add GoogleMaps.framework, as well as the GoogleMaps.bundle which you can find by right-click on GoogleMaps.framework /show in finder under Resources. Drag and drop to the project and make sure it's linked to the project build settings / Copy Bundle Resources
Also, make sure to have all the required framework and libraries listed on the link provided in the question.
Add the -ObjC flag under Build Settings / Other Linker Flags
When it comes to integrate the FacebookSDK, I've noticed that using the latest version isn't working. Apparently, it was prepared to work with xcode 7. Do work around this, just download an older version here
Add FBSDKCoreKit and FBSDKLoginKit to the project and you should be good to go.
Hope that help someone cause it was a pain to make this work...

Related

use_framework! in Podfile caused 'React/RCTBridgeDelegate.h' not found

I'm currently integrating a private library from vendor which they mentioned it's required to have use_framework! added in Podfile. Apparently I found out from them, the framework is written in Objective-C, if so.. why is use_framework! needed? I thought this is the reason why we use use_framework!
use_frameworks tells CocoaPods that you want to use Frameworks instead of Static Libraries. Since Swift does not support Static Libraries you have to use frameworks.
Currently I'm facing this build time issue 'React/RCTBridgeDelegate.h' not found in AppDelegate.h
Side info,
My project is running on React Native Firebase v6, hence I have added # $RNFirebaseAsStaticFramework = true to handle the use_framework! case. Read more about this here.
I'll get the following error if I don't append use_framework!
Framework not found helloFramework
Here's the Xcode error . . . .
I confirmed my project's scheme has the React Bulleyes icon from podfile and I'm building on this scheme
My questions, why do I get this issue when I use use_frameworks! ? What's is the correct way to handle this issue?
Update:
Created issue at React Native Github
TLDR
Append $(inherited) at Framework Search Paths .
Explanation
Apparently, when we apply use_frameworks! at Podfile. Our Xcode project will replace libPods-{projectName}.a with Pods_{projectName}.framework.
Since our project is relying on Frameworks to build, we have to append $(inherited) to Framework Search Paths at Target > Build Settings > Search Paths > Framework Search Paths. This will inherit the build settings from project level to target level. Read more here.

react-native-fbsdk FBSDKCoreKit and FBSDKShareKit not found

I have installed the facebook SDK properly. (This is different from the other not found error because it is specifically for react-native-fbsdk and none of the solutions worked.)
I have tested that I have the SDK installed by importing both the FBSDKCoreKit header and FBSDKShareKit header into AppDelegate.m and it compiled and ran with no issue.
However when I installed react-native-fbsdk and linked it and compiled, I get the error of 'FBSDKCoreKit/FBSDKCoreKit.h' not found. similarly with FBSDKShareKit.
The troubleshooting on the github page gives 3 options to check when this occurs:
Make sure that the Facebook SDK frameworks are installed in ~/Documents/FacebookSDK.
Make sure that FBSDK[Core, Login, Share]Kit.framework show up in the Link Binary with Libraries section of your build target's Build Phases.
Make sure that ~/Documents/FacebookSDK is in the Framework Search Path of your build target's Build Settings.
Which I have checked and verified that I had all of these there was no solution found. The strange thing is that I can import them in AppDelegate.m and it works fine.
You need to make sure you have the SDK frameworks saved under the folder ~/Documents/FacebookSDK
Because react-native-fbsdk iOS project have the value "~/Documents/FacebookSDK" hardcoded in its own definition of Framework Search Paths
If you are like me and don't want to do what Facebook tells you (or you don't want to put random stuff on your Documents folder):
Replace every instance of ~/Documents/FacebookSDK in the QuickStart tutorial with the place you do want to store the SDK, in my case ~/Library/FacebookSDK. That means, unzip the downloaded SDK there and add that route to your project's Framework Search Paths. *
In Xcode's file tree, expand the Libraries group and click on RCTFBSDK.xcodeproj. On that project click Build Settings and add your route to its Framework Search Paths.
And that's it. Just remember you did this when you update the node module, 'cause this change won't be versioned on your project.
*Note: If there are other people working on the project, do not remove ~/Documents/FacebookSDK from your project's Framework Search Paths. This is to be consistent with the module installation and the rest of the team can easily npm install and use the installation guide as documentation.
Drag & drop in Xcode the FacebookSDK files, for example try with FBSDKCoreKit.h

Why am I getting an error regarding Bolts framework and FacebookSDK when I'm not even using Bolts?

Getting this error
framework not found Bolts for architecture x86_64
Followed Facebook's guide word for word, but the only place I can think of an error with linking happening is in the Build Settings for Framework Search Paths. All I currently am attempting in the app is to add a Facebook Login in button, simply visually to make sure it's loading visually. No method functionality is added, but I can't even build the project in this current state.
Open the project in Xcode.
Go to where you extracted the FacebookSDK. If you're using Mac OSX,
it should be available in Documents/FacebookSDK.
Grab the
Bolts.framework file and drop into your Frameworks folder in
Xcode for your project.
It should build now.
you need to add Bolts.framework to your project
As of 24th of April 2019, the Facebook SDK in Swift repo inside this commit:
Removed Bolts from Swift SDK
So you will have to add Bolts to your pod file.
FYI if you're using Swift 5 you will need to use the Bolts in Objc because currently Bolts for Swift only support Swift 4.1.
For Swift 5 in your pod file:
pod 'Bolts'
To answer your question, from Bolts GitHub:
Bolts is a collection of low-level libraries designed to make
developing mobile apps easier. Bolts was designed by Parse and
Facebook for our own internal use
EDIT / UPDATE:
It looks like Bolts for Swift now support Swift 5.
In my case I opened the project instead of the workspace (using pods)
Go to Build Settings of your project.
Search for Framework Search Paths.
Add to debug: "$(inherited)".
Do the same for release.
Re-build the project.
Hope it helps!
You can just do pod update and then open your xcworkspace. Fixed it for me.
Late but might help
- add Bolts.Framework
- also remember to do as warnings shown during installation
Run "pod update" in terminal (if you not updated)
Remove "Bolts" framework from "Other Linker Flags" (Click on target->Build Settings -> Other Linker Flags)

Xcode: create Framework with pod dependecies

I create a framework that use AFNetworking (installed with pod).
I can import this framework on my project and I can use all classes/methods that I exposed, so project compile.
When I try to run project on simulator, I obtain this error:
dyld: Library not loaded: #rpath/AFNetworking.framework/AFNetworking
Referenced from:
/Users/.../Library/Developer/CoreSimulator/Devices/F56F98F0-2AE0-4C87-AC9A-6E3B449762D1/data/Containers/Bundle/Application/BFA5359F-8FCE-4402-8487-CD9C002CB673/MyProject.app/Frameworks/MyFramework.framework/MyFramework
Reason: image not found
I already included 'MyFramework' under:
Build phases -> Embed Frameworks
I suppose I missing something on building Frameworks, but I can find out what! I already seen this unanswered question.
Who can I use MyFramework without installing Pod on MyProject again?
It is really delayed, for this issue but I have got my project working. It might not be the best way but it works. I am putting it here for future reference.
I wanted to do it without using Pods in the main project. The reasoning is, we are bundling our SDK into a framework.
So essentially, the first step I took was to get the framework project bundling without using the workspace. I just dragged the Pods project into the framework project.
Then I added the frameworks the the pods project creates and add them to my framework. I set them to optional and code sign. You can see them in the picture of where I added them under the build phases.
Then add them to your main project. not the framework the normal way by adding the project and or the framework. Then add it to the Embedded binaries and Linked Frameworks.
If it helps anyone, the solution mentioned by #ArtyomDevyatov does work. The trick is that you have to add 's.dependency' in podspec file.

Integrating YouTube Data API v3 iOS

I am trying to integrate the YouTube Data API v3 for iOS into my project. In the end all I want to do is upload videos from all instances of the app to a company owned youtube channel, and get the URL to be able to embed the videos in a website. I can't figure out how to integrate the client library for iOS though. I get compile errors, or ARC issues that I can't figure out how to resolve. The files are found here: https://code.google.com/p/google-api-objectivec-client/source/checkout
In short this is what I did:
In my project I added the GTLYouTube_Sources.m, GTLCommon_Sources.m and GTLNetworking_Sources.m.
Make sure that Build Phases -> Compile Sources the compiler flag '-fno-objc-arc' is set for these three files. This should fix your ARC issues.
You may need to set some search paths in your Build Settings if the compiler complains that it can't find a file.
Hope this helps!
I had issues but with a combination of google's page + a youtube tutorial I was able to get things working, I still don't know how to search yet but here are my notes on the subject:
This file points in the right direction - https://code.google.com/p/google-api-objectivec-client/wiki/BuildingTheLibrary
This video is better - https://www.youtube.com/watch?v=q7m3qCsQBEE
As per my comment on the video stream - "
I did this tutorial and receive 9 linker errors referencing the derived data folder and that "file was built for archive which is not the architecture being linked (x86_64)" but have "Standard Architectures" selected in the Build Settings for the project (armv7,arm64). This is using Xcode 6 but I can try on Xcode 5.1.1 if needed (though I don't think this issue will abate as it supports the 64bit architecture as well. Going into the GTL Project and selecting the GTLTouchStaticLib and changing the architecture over to Standard removed the linker errors and the build succeeded! https://www.dropbox.com/s/f6tc6t33r5k5021/Screenshot%202014-10-10%2012.08.00.png?dl=0”
API Calls may still with 401 despite having an API key due to a known issue - https://code.google.com/p/gdata-issues/issues/detail?id=5770#makechanges to fix is remove the bundle ID from the google console.
i'm giving an updated answer for this question. so it can be helpfull to community.
NOTE:- GTL is converted to GTLR . GoogleLibrary is updated. i Recommend to use cocoapods because it will be simple.(according to me) here is the link for this migration
1) create pod file for your project. by pod init & pod install in your terminal. it will create blank pod installation.(ignore if you have done already)
2) add these pod library name in pod file.
here is the some services that can be useful
pod 'GoogleAPIClientForREST'
pod 'GoogleAPIClientForREST/YouTube' //here '.../YouTube' is the service. you can use ".../Caledar' ,".../Translate" or which you want.
pod 'GTMAppAuth'
3) add these headers (i recommend to create Prefix Header '.pch' for your project.)
#import <GTMAppAuth/GTMAppAuth.h>
#import <AppAuth/AppAuth.h>
#import "GTLRYouTube.h" //here you can change double quotation ("...") with (<...>) if this throws the error "library not found".
4) this step is optional..
select your project target & go to build settings. and search for OtherLinkerFlags and add $(inherited)
NOTE:- if you can use Firebase to use google's service it will be more easy.(i've tried it and it was simple than google developer console. this is my personal opinion.)

Resources