2017-05-11 19 views
0

现在我们正在研究在iOS应用中使用Firebase实时数据库的项目。是否可以在iOS iOS应用程序中为发布和调试模式制作不同的Firebase数据库?如何在单个iOS项目/应用程序中为不同的Firebase数据库发布和调试模式(测试和生产环境)?

项目:(应用程序与发布/调试模式)

  1. 调试模式(测试环境) - 火力地堡数据库1种
  2. 释放模式(生产环境) - 火力地堡数据库2

什么是解决Firebase数据库的测试/生产环境的最佳方案吗?

+0

我认为它解决您的问题** ** http://stackoverflow.com/questions/37360919/how-to-run-debug-app-version-on-a-debug-firebase-database –

+0

这个答案适用于Android。我正在问iOS。 – jazzbpn

+0

可能有用的帖子[这里](http://stackoverflow.com/q/29637381/4625829) –

回答

0

如果你已经使用不同的数据库进行DEBUG和发布构建,那么你必须小心以下的事情。我认为这不是一个好主意。

1)各个.plist文件应该在项目中。

2)根据基本URL添加/删除。

上述问题的最佳方法。

假设你的BaseURL是:https://xxxxxxx.firebaseio.com

对于调试构建: - https://xxxxxxx.firebaseio.com/Debug

对于发行版: - https://xxxxxxx.firebaseio.com

0

有两个简单的步骤

第一步终于解决:复制GoogleService-Info-dev.plistGoogleService-Info.plist到项目工作区。

步骤2:根据调试/生产环境中didFinishLaunchingWithOptions只要改变...-的Info.plist

/* 
* Here in didFinishLaunchingWithOptions method, 
* just change the *...info.plist* file path according to the requirement 
*/ 
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 

    // DEBUG ENVIRONMENT 
    //let filePath = Bundle.main.path(forResource: "GoogleService-Info-dev", ofType: "plist")! 

    // PRODUCTION ENVIRONMENT 
    let filePath = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist")! 

    let options = FIROptions(contentsOfFile: filePath) 
    FIRApp.configure(with: options!) 

    return true 
} 
相关问题