Is it possible to disable ATS in iOS 9 just for debug environment?

前端 未结 3 1791
忘掉有多难
忘掉有多难 2020-12-01 13:54

I\'m working on a development environment without HTTPS setup. Is it possible to automatically disable ATS just for the development (debug) mode?

3条回答
  •  不知归路
    2020-12-01 14:49

    Another solution. By using INFOPLIST_PREPROCESS = YES and INFOPLIST_PREPROCESSOR_DEFINITIONS = DEBUG=1,

    it can be conditional preprocess like C code using #ifdef or #if directly in Info.plist.

    UIMainStoryboardFile
    Main
    #if DEBUG
    NSAppTransportSecurity
    
        NSAllowsArbitraryLoads
        
    
    #endif
    UIRequiredDeviceCapabilities
    
    

    Cons: Unable to open Xcode's property list editor because it is not well-formed XML :(

提交回复
热议问题