代码之家  ›  专栏  ›  技术社区  ›  Varun Gupta

在调试模式下运行项目时,未在Xcode中设置调试宏

  •  0
  • Varun Gupta  · 技术社区  · 6 年前

    我创建了一个新的react原生项目,其中包括一个Android项目和一个iOS项目。我用的是Swift,所以我把 AppDelegate.m AppDelegate.h 文件 AppDelegate.swift . 我使用 DEBUG

        #if DEBUG
          let jsCodeLocation = RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index", fallbackResource:nil)
        #else
          let jsCodeLocation = Bundle.main.url(forResource: "main", withExtension: "jsbundle")
        #endif
    

    我在找 debug Build Settings 在Xcode上,我发现下面的设置似乎是正确的。

    enter image description here

    我怎样才能保证 宏是在运行调试模式时设置的,否则不设置。谢谢。

    0 回复  |  直到 6 年前
        1
  •  3
  •   Inder Kumar Rathore user4622654    6 年前
    1. 打开项目生成设置并搜索 Swift Compiler – Custom Flags
    2. 在这个下面 Other Swift Flags -DDEBUG 到调试部分

    lib