Comment on page
Objective-C
In Appfigurate Simulator app, under the OBJ-C/IOS LIBRARY INTEGRATION section:
Tap
Output header
then tap Console
.Tap
Output implementation
then tap Console
.Tap
Output UIAppDelegate snippet
then tap Console
.Tap
Output UIWindowSceneDelegate snippet
then tap Console
.Tap
Output Info.plist snippet
then tap Console
.The output will appear in the macOS
Console.app
. Select the iOS Simulator device in the left hand pane. Type process:appfigurate
in the search box in the top right.In your app, add a new Cocoa Touch class, subclassing
APLConfiguration
, called Configuration
.In your apps
Configuration.h
file, paste the .h header file output to the Console in Output source code snippets.@import Foundation;
@import AppfigurateLibrary;
@interface Configuration : APLConfiguration
@property(nonatomic, strong) NSString* serverURL;
@property(nonatomic, assign) BOOL debugLogging;
@end
In your apps
Configuration.m
file, paste the .m 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 "Configuration.h"
@implementation Configuration
BOOL_PROPERTY(debugLogging, @"Log debug output to console", NO)
STRING_PROPERTY_LIST_EDIT(serverURL, @"https:\\/\\/[\\w\\.-]+\\.yourappserver.com/.*", @"URL of app server", NO, @{@"Dev":@"https://dev.yourappserver.com/api", @"Prod":@"https://www.yourappserver.com/api"});
- (BOOL) allowInvalidSignatures {
#if DEBUG
return YES;
#else
return NO;
#endif
}
- (NSString*) publicKey {
// E4 8B B6 25 EE 01
return @"-----BEGIN PUBLIC KEY-----\n" \
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnD67fMex1KkP7kltlNaO\n" \
"wncfzWUuWIH7C6xMPczJMPpmTNLkq1LhAhGfJMXByHHR4m9dqHO/pQZ1pFqtTSti\n" \
"ZBw81DQqOHAINQEf1vhJw1b7EMOFUAsS98X32imT9mNC9ya8n8AB2b5giQpef9YJ\n" \
"PHV0IPUo9t6DUQIOtMG5YLNqrFmp40HpW7r2vGmi8Vh7fCZHFwWS3QvsUqj4tYsr\n" \
"S3IyVOGfiQXxrEVtfKM/ABtj7oxqe6rr/UYyFfVasqYxnUrL+RgnLieAO88dhtOh\n" \
"dAHDAZiVMPnJ8CN42XShGNC6i1vQb0tg6op0KpoBCd94tVqB55wa+WpXAc86qF+t\n" \
"EQIDAQAB\n" \
"-----END PUBLIC KEY-----\n";
}
- (void) reset {
self.debugLogging = NO;
self.serverURL = @"https://www.yourappserver.com/api";
}
@end
Class APLConfigurationClass(void) {
return [Configuration class];
}
The C
APLConfigurationClass
function must be implemented in your app otherwise a linker error will be issued. The recommended place to implement is at the bottom of your APLConfiguration
subclass.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.In your apps
AppDelegate.m
file, include calls to APLApplicationOpenURL
and APLDidFinishLaunchingWithOptions
. Paste the UIApplicationDelegate
snippet output to the Console in Output source code snippets.- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
return APLApplicationOpenURL(url);
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
APLApplicationDidFinishLaunchingWithOptions(launchOptions);
return YES;
}
If your app targets iPadOS 13+, in your apps
SceneDelegate.m
file, include a call to APLApplicationOpenURL
. Paste the UIWindowSceneDelegate
snippet output to the Console in Output source code snippets.- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
NSURL* url = [[[URLContexts allObjects] firstObject] URL];
if (url != nil) {
APLApplicationOpenURL(url);
}
}
To test that you've successfully updated your 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
BOOL_PROPERTY
for debugLogging
and STRING_PROPERTY_LIST_EDIT
for serverURL
, you can now change these configuration items at runtime. Tap Apply⌄
to apply the configuration to the Quickstart
app.Last modified 2mo ago