Comment on page
Flutter iOS
Run Appfigurate in the iOS Simulator.
Tap
≡
Add app
.Select app type
iOS
.Enter the URL scheme
quickstart
that will be used by Appfigurate to launch your app in order to read or apply configuration. The URL scheme must be 4-64 ascii characters in length and must be unique to your app.Tap
Add app
.In your app, add a new Swift class, subclassing
APLConfiguration
, called Configuration
.In your apps
Configuration.swift
file, paste the .swift implementation file output to the Console in Output source code snippets.Note: your public key output to the Console in Output source code snippets will be different to the public key in the following example.
import Foundation
import AppfigurateLibrary
@objcMembers class Configuration: APLConfiguration {
@BoolProperty(description: "Log debug output to console", restart: false)
var debugLogging: Bool
@StringPropertyListEdit(regex: #"https://[\w\.-]+\.yourappserver.com/.*"#, description: "Application server url", restart: false, values: ["Dev":"https://dev.yourappserver.com/api", "Prod":"https://www.yourappserver.com/api"])
var serverURL: String
override func allowInvalidSignatures() -> Bool {
return !ENCRYPTED()
}
override func publicKey() -> String {
// 41 36 87 71 0D 05
return "-----BEGIN PUBLIC KEY-----\n" +
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4TZnKfGeXttN7Rr3eiAZ\n" +
"PMEPsZvbo7lgIpMh6OjgBsoqkJJP0yXXLtpqsBCv8vm7RYqCn5+yfkiCQiXvkJBz\n" +
"FSKmLF9EPR9l1H+32Id82dDuseD70D66puPUHjciEgmU18DpW2NVvTAykMwTEsiR\n" +
"0h/ExBEhUe75qtwlVno8cMFbEfVtiGbKECvWIr122ED71T0Jt2Bcxqx1a7c1hPIV\n" +
"RwLxIfWfE0+2rB9nJVPBgsTVPywibDvjio82FousyMDmvkAbMq5iyuyvJ0+5bATz\n" +
"o12GEt5lSiQlCMzfmkWYBROMDCh27qGFVVo1XAUCVsMfsW9n4iQcoLAdUp/LI3B3\n" +
"ywIDAQAB\n" +
"-----END PUBLIC KEY-----\n";
}
override func reset() {
debugLogging = true
serverURL = "https://www.yourappserver.com/api"
}
}
@_cdecl("APLConfigurationClass")
func APLConfigurationClass() -> AnyClass {
return Configuration.self
}
In your apps
Info.plist
file (right click, Open As ‣ Source Code). Paste the Info.plist
snippet output to the Console in Output source code snippets.<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>appfigurate.quickstart</string>
<key>CFBundleURLSchemes</key>
<array>
<string>quickstart</string>
</array>
</dict>
</array>
If you already have an existing
CFBundleURLTypes
array in your Info.plist
file, then insert just the <dict> ... </dict>
portion.Note: Unlike iOS native integration, the Appfigurate Flutter Plugin automatically calls
APLApplicationOpenURL
and APLDidFinishLaunchingWithOptions
at the appropriate time. To test that you've successfully updated your iOS app to use Appfigurate:
Compile and run
Quickstart
to the same Simulator instance that Appfigurate Simulator was run from previously.Press
Shift-Cmd-H
to get back to the Simulator home screen.Tap the Appfigurate app icon.
Tap the
Quickstart
row. The Simulator screen will briefly flicker as it swaps to the Quickstart
app, reads its configuration and swaps back to Appfigurate.Appfigurate will now be displayed and showing the following screen:
- Since we added a
@BoolProperty
fordebugLogging
and@StringPropertyListEdit
forserverURL
, you can now change these configuration items at runtime. TapApply⌄
to apply the configuration to theQuickstart
app.
Last modified 8mo ago