Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
399 views
in Technique[技术] by (71.8m points)

objective c - Google Api error "Multiple methods named 'initWithArray:' found"

I am using the google calendar api and I am getting two errors.

  1. GTMGatherInputStream.m:25:13: Multiple methods named 'initWithArray:' found

    #import "GTMGatherInputStream.h"
    @implementation GTMGatherInputStream
    + (NSInputStream *)streamWithArray:(NSArray *)dataArray {
        return [[[self alloc] initWithArray:dataArray] autorelease]; //error on this line
    }
    
  2. GTMOAuth2Authentication.h:31:11: 'GTMSessionFetcher.h' file not found

    #if GTM_USE_SESSION_FETCHER
    #import "GTMSessionFetcher.h" //GTMSessionFetcher.h file not found error
    #else
    #import "GTMHTTPFetcher.h"
    #endif  // GTM_USE_SESSION_FETCHER
    

I have researched the error everywhere online and I have found nothing. I am running GM El capitan with GM Xcode 7.0. I Have tried multiple different ways on solving it and nothing has worked. My code will not compile. How do I fix this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I assume Google is going to implement a fix for this in the near future; in the meantime, we can do a couple of hacks to get around those issues:

  1. change return [[[self alloc] initWithArray:dataArray] autorelease];

    to

    return [[(GTMGatherInputStream*)[self alloc] initWithArray:dataArray] autorelease];

  2. change

    #ifndef GTM_USE_SESSION_FETCHER
    #define GTM_USE_SESSION_FETCHER 1
    #endif
    

    to

    #ifndef GTM_USE_SESSION_FETCHER
    #define GTM_USE_SESSION_FETCHER 0
    #endif
    

I had to do this in two places where GTM_USE_SESSION_FETCHER was defined.

One final thing, was to go to the GTL project build settings, and set Apple LLVM 7.0 warnings Deprecated Functions to NO. With these 3 steps the Calendar API compiles successfully on iOS9.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...