Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Swift by fail ( 8 years ago )
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        
        // Realm Migration.
        
        let config = Realm.Configuration(
            schemaVersion: 3,
            migrationBlock: { migration, oldSchemaVersion in
                if (oldSchemaVersion < 3 xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed> else { return }
            let parkingAreas = realm.objects(ParkingArea.self)
            try! realm.write() {
                realm.delete(parkingAreas)
            }
            
            json.flatMap { ParkingArea(json: $0) }
        }
        
        APIEndpoint.rentingAreas.request { (apiResponse) in
            guard let json = apiResponse.result.value as? Array<[String: Any]> else { return }
            let rentingAreas = realm.objects(RentingArea.self)
            try! realm.write() {
                realm.delete(rentingAreas)
            }
            
            json.flatMap { RentingArea(json: $0) }
        }
        
        // Google Services.
        
        FirebaseApp.configure()
        GMSServices.provideAPIKey("AIzaSyAwBEwrTU8UhQSdx7cFDkpvetYt5G9DZ54")
        
        // Bugsee
        
        Bugsee.launch(token :"f3e96291-dbcb-44e8-ad8a-3bba6dbbdc00")
        
        // Push Notifications.
        
//        UNUserNotificationCenter.current().delegate = self
        
        let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
        UNUserNotificationCenter.current().requestAuthorization(
            options: authOptions,
            completionHandler: {_, _ in })
        
        application.registerForRemoteNotifications()
        
        // MARK: - User Service.
        
        userService.updateReferenceData()
        
        // MARK: - RentState Service.
        
        RentStateService.shared.startUpdating()
        
        return true
    }

 

Revise this Paste

Your Name: Code Language: