I implement access to Google Drive in my iOS app. This has been an active feature in the app since middle of 2014 and functions properly under iOS 6, 7 & 8. I am currently checking my project for compatibility with iOS 9.
I've downloaded the latest google-api-objectivec-client
to ensure my project remains up to date.
I redid the standard Google implementation... as detailed in this page and included for completeness at the end of this post.
Problem: When I attempt to build in any of my releases I receive the error "GTMSessionFetcher.h
file not found".
I'm certain I've implemented the API properly as per the steps below / on the Google web page.
I've looked through older versions of my code but unfortunately I did not back up the Google SDK, so cannot easily tell what has changed.
It seems to stem from this... within GTMOAuth2Authentication.h
...
#if GTM_USE_SESSION_FETCHER
#import "GTMSessionFetcher.h"
#else
#import "GTMHTTPFetcher.h"
#endif // GTM_USE_SESSION_FETCHER
I dont understand how GTM_USE_SESSION_FETCHER
is set and why it would be true in this instance.
Any advice greatly appreciated.
Google Drive API Implementation for iOS
Note: Steps 1 & 2 complete without issue.
Step 3: Prepare the project
GTL.xcodeproj
from the Source
directory of the client library download folder above into the XCode project.Link Binary with Libraries
list to include:
libGTLTouchStaticLib.a
from the GTL project.Security.framework
and SystemConfiguration.framework
.-ObjC -all_load
to the Linking > Other Linker Flags setting. A good way to edit these fields is to click once on the field name to select it, then click Enter to input the setting.GTMOAuth2ViewTouch.xib
from client library's Source/OAuth2/Touch
folder into the app's Supporting Files
folder.GTLDrive.h
and GTLDrive_Sources.m
from the client library's Source/Services/Drive/Generated
folder directly to the application project.Thanks initially to Rivero for pointing me in the right direction...
Thanks to Peter for his answers to this question.
Building for iOS 6, 7, 8 & 9...
Hacked the following...
STEP 1
In GTMOAuth2Authentication.h
(OAuth directory) and in GTLService.h
(Objects directory)
find this code block...
#if (!TARGET_OS_IPHONE && defined(MAC_OS_X_VERSION_10_11) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11) \
|| (TARGET_OS_IPHONE && defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0)
#ifndef GTM_USE_SESSION_FETCHER
#define GTM_USE_SESSION_FETCHER 1
#endif
#endif
... and change
#define GTM_USE_SESSION_FETCHER 1
... to
#define GTM_USE_SESSION_FETCHER 0
STEP 2
In GTMGatherInputStream.m
(HTTPFetcher directory)
... change
return [[[self alloc] initWithArray:dataArray] autorelease];
... to
return [[(GTMGatherInputStream*)[self alloc] initWithArray:dataArray] autorelease];
STEP 3
In GTMHTTPFetcherLogging.m
(HTTPFetcher directory)
... change
NSString *escapedResponseFile = [responseDataFileName stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
... to
NSString *escapedResponseFile = [responseDataFileName stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
STEP 4
In GTL
project settings, under Apple LLVM 7.0 Warnings - All Languages
... change
Deprecated Functions = YES
... to
Deprecated Functions = NO
@andrewbuilder's solution works.
If your target is IOS 8, just change
#define GTM_USE_SESSION_FETCHER 1
to
#define GTM_USE_SESSION_FETCHER 0
in both GTMOAuth2Authentication.h and GTLService.h files.
If your target is IOS 9, you need to replace the GTMHTTPFetcher file with GTMSessionFetcher file (https://code.google.com/p/gtm-session-fetcher/).
Reference: https://github.com/google/google-api-objectivec-client/issues/88
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With