指向谷歌云终端iOS客户端在开发服务器上

时间:2014-12-15 17:39:53

标签: ios google-app-engine google-cloud-endpoints

在我的本地开发服务器上部署Google云端点,并使用此处列出的步骤生成iOS客户端库:

https://cloud.google.com/appengine/docs/java/endpoints/consume_ios

我试图将iOS客户端指向我的开发服务器。我尝试将self.rpcURL中的GTLMyApi.h更改为我的本地开发网址,如下所示:

self.rpcURL = [NSURL URLWithString:@"http://x.x.x.x:8080/_ah_api/rpc?prettyPrint=false"];

来自原始值:

self.rpcURL = [NSURL URLWithString:@"https://myapi.appspot.com/_ah/api/rpc?prettyPrint=false"]

但是抛出异常:

Insecure fetch request has a scheme (http) not found in fetcher allowInsecureSchemes...

2 个答案:

答案 0 :(得分:1)

您应该能够允许HTTP:

service.fetcherService.allowedInsecureSchemes = @[ @"http" ];

在您的情况下,它可能是自我而非服务。

答案 1 :(得分:0)

我在iOS应用中设置如下rpcURL:

self.rpcURL = [NSURL URLWithString:@"https://myapp.appspot.com/_ah/api/rpc?prettyPrint=false"];
#if DEBUG
self.fetcherService.allowedInsecureSchemes = @[@"http"];
self.allowInsecureQueries = YES;
self.fetcherService.allowLocalhostRequest = YES;
self.rpcURL = [NSURL   URLWithString:@"http://192.168.0.2:8888/_ah/api/rpc?prettyPrint=false"];
#endif

中的GTMOAuth2Authentication.m中
- (BOOL)authorizeRequestImmediateArgs:(GTMOAuth2AuthorizationArgs *)args

之后:

BOOL isAuthorizableRequest = self.shouldAuthorizeAllRequests
|| [scheme caseInsensitiveCompare:@"https"] == NSOrderedSame
|| [requestURL isFileURL];

我已加入:

#if DEBUG
isAuthorizableRequest = self.shouldAuthorizeAllRequests
|| [scheme caseInsensitiveCompare:@"http"] == NSOrderedSame
|| [requestURL isFileURL];
#endif

希望这有帮助。