I'm trying to import either GoogleAPIClient or GoogleAPIClientForREST

自作多情 提交于 2019-12-04 13:42:35

Use this for your Podfile:

platform :ios, '7.0'
use_frameworks!
target 'QuickstartApp' do
    pod 'GoogleAPIClientForREST/Drive', '~> 1.1.1'
    pod 'GTMOAuth2', '~> 1.1.0'
end

Change your import to

import GoogleAPIClientForREST

Then follow the instructions here to migrate the project: Migrating from GoogleAPIClient to GoogleAPIClientForREST

This mostly involves changing GTL calls to GTLR calls with some word swapping. For example, GTLServiceDrive becomes GTLRDriveService.

Regarding framework search paths, this image shows the section you might need to change (note it works for me using the default):

Search paths can be per target, too. Here's an image showing the application target and the framework search paths:

rahul verma

Although the solution towards which I am pointing you might be for other library, but it will help you for sure. https://stackoverflow.com/a/25874524/5032645 . Please try and let me know, if I should simplify it more for you.

First, look at the Pods_QuickstartApp.framework in the Frameworks group of your Quickstart project. If it is still red, as it is on your screenshot, then Xcode didn't build it. If Xcode didn't build the framework, Xcode can't import it for you.

Cocoapods builds a workspace including your app project, plus another project that assembles your individual pod frameworks into a larger framework.

It seems cocoapods built your workspace, and you did open the workspace instead of the project. That's good.

Check the contents of the file named "Podfile". It should match:

platform :ios, '7.0'
use_frameworks!
target 'QuickstartApp' do
    pod 'GoogleAPIClient/Drive', '~> 1.0.2'
    pod 'GTMOAuth2', '~> 1.1.0'
end

If it doesn't, fix it, exit Xcode, delete the .xcodeworkspace file, and then run

pod install

from the console. That may fix your dependencies so that Xcode builds the frameworks.

If you do get it to compile, your problems have just begun. Google has deprecated the OAAuth authorization from an embedded user-agent.

So I followed the Quickstart tutorial exactly as well and was able to get it working. I moved the GoogleAPIClientForRest in Framework Search Paths above GTMOAuth2:

Screenshot

I ran into an error in the code after successfully including the module and had to change this line to get it to build and run: if (result.files!.count to if (result.files!.count > 0).

Of course now, Google has deprecated GTMOAuth2 and replaced it with GTMAppAuth, which renders this app useless.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!