【发布时间】:2020-05-09 23:48:30
【问题描述】:
我正在开发 React-Native 应用程序,并希望配置可以与 iOS 应用程序和 Android 共享的环境变量。
文档要求我在 AppDelegate.m 中添加这一行
[GMSServices provideAPIKey:@"Azzz8"];`
这里 Azzz8 将是我的 api 密钥。现在我想将它传递到环境文件中并从那里传递(到 ios 和 android)。知道我该怎么做吗?
这就是我的 AppDelegate.m 代码的样子
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "AppDelegate.h"
#import <Firebase.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTLinkingManager.h>
#import <UMCore/UMModuleRegistry.h>
#import <UMReactNativeAdapter/UMNativeModulesProxy.h>
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
#import <GoogleMaps/GoogleMaps.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
/* Firebasee App Config */
[FIRApp configure];
[GMSServices provideAPIKey:@"1234"];
【问题讨论】:
标签: ios swift react-native