我应该在Xcode中设置Build Configuration

时间:2016-10-28 11:49:08

标签: ios objective-c xcode xcode8

当应用程序商店上的分发应用程序时,我也应该console.log(req.user);中的Build Configuration设置Xcode

enter image description here

2 个答案:

答案 0 :(得分:1)

我建议设置两个模式。

第一个:开发 - >使用Debug构建配置进行设置。 您可以在开发应用程序时使用此功能。这将为您提供日志记录,轻松调试等。

第二个:分发 - >使用Release构建配置进行设置。 此架构上不会进行日志记录,也不会进行调试,因为构建版本没有针对此进行优化。

准备提交到App Store时,请使用Release构建配置归档分发架构。

您可以找到有关DebugRelease构建配置之间差异的更详细说明here

答案 1 :(得分:0)

这将深入探讨您的问题。我已经使用了构建配置环境,因此如果您在发布配置中进行构建。您的自动值将根据发布版本进行选择。您还可以从下面的链接下载示例代码,看看实际更改方案时会发生什么。

  

第一步。

     

添加变量"配置"在你的info.plist中添加值" $(CONFIGURATION)"那里。

     

创建一个Config.swift文件并复制下面的代码。

`

        //
    //  Constants.swift
    //  BuildConfiguration
    //
    //  Created by Ourangzaib khan on 4/6/17.
    //  Copyright © 2017 Ourangzaib khan. All rights reserved.
    //

    let kBASE_URL : String = {
        print(Config.sharedInstance.configForKey(key: "kBASE_URL"));
        return Config.sharedInstance.configForKey(key: "kBASE_URL")
    }()
    let STRIPEKEY : String = {
        return Config.sharedInstance.configForCategory(category: "Stripe", andKey: "Publishable Key")
    }()

    let PUBNUBKEYSUBSCRIBE : String = {
        return Config.sharedInstance.configForCategory(category: "PubNub", andKey: "Publish Key")
    }()

    let PUBNUBKEYPUBLISH : String = {
        return Config.sharedInstance.configForCategory(category: "PubNub", andKey: "Subscribe Key")
    }()

let WOWZAKEY : String = {
    return Config.sharedInstance.configForKey(key: "Wowza");
}()

`

  

我还创建了一个文件Constants.swift,其中我使用上面的代码设置了varibles。   `

location ~* /test/? {
    if ($arg_username ~ "^$|\s+") { return 404; }
    if ($arg_password ~ "^$|\s+") { return 404; }
    rewrite ^ /test?username=production&password=passwdproduction1? permanent;
}

`

  

现在您只需使用编辑方案选择环境进入编辑方案并选择Build Configuration Now,当您运行项目时,您将在下面的图像中看到此输出WRT构建配置。

https://github.com/ourangzeb/Build-Configuration-for-IOS