Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.
Edit Xcode Scheme and add a pre-action script.
Copy the contents of preaction.sh into the pre-action script box.
Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.
Edit Xcode Scheme and add a pre-action script.
Copy the contents of preaction.sh into the pre-action script box.
| import Foundation | |
| let config = NSURLSessionConfiguration.defaultSessionConfiguration() | |
| let userPasswordString = "[email protected]:password" | |
| let userPasswordData = userPasswordString.dataUsingEncoding(NSUTF8StringEncoding) | |
| let base64EncodedCredential = userPasswordData!.base64EncodedStringWithOptions(nil) | |
| let authString = "Basic \(base64EncodedCredential)" | |
| config.HTTPAdditionalHeaders = ["Authorization" : authString] | |
| let session = NSURLSession(configuration: config) |
| Step 1: Enable capabilities "background fetch" | |
| Step2 : Setup AppDelegate.swift | |
| func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
| let settings = UIUserNotificationSettings(forTypes: UIUserNotificationType.Alert, categories: nil) | |
| UIApplication.sharedApplication().registerUserNotificationSettings(settings) | |
| UIApplication.sharedApplication().setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum) | |
| return true; |
| /// Used to interact with the 2k games server API, and upload images to the server | |
| class APIOperations: NSObject, NSURLSessionDelegate { | |
| /** This method is using just a genereic URLSession to upload image to a server | |
| - Parameters: | |
| - Image: image to upload | |
| - imageType: kind of image (2k type) don't confuse it with png/jpg | |
| - callback: callback that contains information about successful or failed operation |
Note: I'm currently taking a break from this course to focus on my studies so I can finally graduate