我正在使用谷歌日历API,我收到两个错误。
GTMGatherInputStream.m:25:13:找到名为'initWithArray:'的多个方法
#import "GTMGatherInputStream.h"
@implementation GTMGatherInputStream
+ (NSInputStream *)streamWithArray:(NSArray *)dataArray {
return [[[self alloc] initWithArray:dataArray] autorelease]; //error on this line
}
GTMOAuth2Authentication.h:31:11:找不到'GTMSessionFetcher.h'文件
#if GTM_USE_SESSION_FETCHER
#import "GTMSessionFetcher.h" //GTMSessionFetcher.h file not found error
#else
#import "GTMHTTPFetcher.h"
#endif // GTM_USE_SESSION_FETCHER
我在网上到处都研究过这个错误,但我什么都没发现。我正在使用GM Xcode 7.0运行GM El capitan。我已经尝试了多种不同的方法来解决它,但没有任何工作。我的代码不会编译。我该如何解决?
我认为Google将在不久的将来为此实施此修复程序;与此同时,我们可以做几个黑客来解决这些问题:
更改 return [[[self alloc] initWithArray:dataArray] autorelease];
至
return [[(GTMGatherInputStream*)[self alloc] initWithArray:dataArray] autorelease];
更改
#ifndef GTM_USE_SESSION_FETCHER
#define GTM_USE_SESSION_FETCHER 1
#endif
至
#ifndef GTM_USE_SESSION_FETCHER
#define GTM_USE_SESSION_FETCHER 0
#endif
我不得不在两个地方这样做 GTM_USE_SESSION_FETCHER
被定义了。
最后一件事是进入GTL项目构建设置,并设置Apple LLVM 7.0警告 Deprecated Functions
没有。通过这3个步骤,Calendar API在iOS9上成功编译。
我还必须处理一个错误 Comparison of address of ... not equal to null pointer is always true
这导致应用程序无法构建。必须修改GTMOAuth2ViewControllerTouch.m的第340和1088行
例如。,
// CGP; 9/30/15; took out "&" before kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
//if (accessibility == NULL
// && &kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly != NULL) {
if (accessibility == NULL
&& kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly != NULL) {
accessibility = kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly;
}
改变自我 [[[self alloc] initWithArray:dataArray] autorelease]
至 GTMGatherInputStream
。它对我有用:
#import "GTMGatherInputStream.h"
@implementation GTMGatherInputStream
+ (NSInputStream *)streamWithArray:(NSArray *)dataArray {
return [[[GTMGatherInputStream alloc] initWithArray:dataArray] autorelease];
}