technique to separate API keys in a xcconfig file described in this answer不适用于Swift 2.2
due to a bug (SR-909).
有没有解决方法?
解决方法
感谢您指出该错误,不会在一段时间内想出这个.如果有任何帮助,我最后添加了一个额外的objc常量桥接到Swift并使用swift中的桥接常量:
// Constants.h extern NSString *const kDropBoxAPIKey; // Constants.m NSString *const kDropBoxAPIKey = DROPBox_API_KEY; // xxx-Bridging-Header.h #import "Constants.h"
然后在Swift中使用桥接键
// xx.swift ... // let auth = DropBoxAuth(appKey: DROPBox_API_KEY) let auth = DropBoxAuth(appKey: kDropBoxAPIKey) ...