iOS Application Configuration File

后端 未结 8 1496
南笙
南笙 2021-01-31 16:13

In a C# application I always used an app.config file to save some data for my application to load when needed (e.g Connection String).

Wha

8条回答
  •  情话喂你
    2021-01-31 16:49

    iOS Application Configuration File in Swift with iOS 8.3:

        let path: String = NSBundle.mainBundle().pathForResource("Info", ofType: "plist")!
        let nsDictionaryInfoPlist: NSDictionary = NSDictionary(contentsOfFile: path)!
    
        // Usage example: Google Maps iOS SDK/API Configuration.
        GMSServices.provideAPIKey(nsDictionaryInfoPlist.objectForKey("GoogleMapsiOSAPIKey") as! String)
    

提交回复
热议问题