【发布时间】:2020-07-02 23:08:46
【问题描述】:
根据类似问题Hide Google Maps API key from source control in a Flutter app的指示
AppDelegate.m
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSString* mapsApiKey = [[NSProcessInfo processInfo] environment][@"FLUTTER_GMAPS_API_KEY"];
[GMSServices provideAPIKey: mapsApiKey];
[GeneratedPluginRegistrant registerWithRegistry:self];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end
如果我将 provideApiKey 更改为 @"theApiKeyImTryingToHide" 一切正常。
【问题讨论】:
-
您找到解决方案了吗?
-
不,我没有,抱歉
-
我不知道这是否是您要找的东西,但我 posted an answer 回答了您提到的问题。希望有帮助)
-
@tatusDn 这正是我要找的,非常感谢!