APLConfiguration

@interface APLConfiguration : NSObject

Availability: All.

Subclass APLConfiguration and declare and implement properties to configure using the Appfigurate app (Simulator or App Store) with the BOOL_PROPERTY, INT_PROPERTY_, FLOAT_PROPERTY_, DOUBLE_PROPERTY_, STRING_PROPERTY_ or ENCRYPTED_STRING_PROPERTY_ macros. You must override the -[APLConfiguration publicKey] method.

  • Availability: All.

    The singleton instance of the APLConfiguration subclass. The instance is automatically instantiated on application (or extension) startup. It is permissible to have a multi-level class hierarchy if required. e.g. AppConfiguration ‣ CommonConfiguration ‣ APLConfiguration.

    Declaration

    Objective-C

    + (APLConfiguration *_Nonnull)sharedConfiguration;
  • Availability: All.

    Override to return the public key for this application. Use the Appfigurate app (Simulator or App Store) to output the public key(s).

    Objective-C example

    - (NSString*) publicKey {
    #if TARGET_OS_IOS
       return @"-----BEGIN PUBLIC KEY-----\n" \
         "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5s2YXfKStHzgUEkY+KDm\n" \
         "yQUMO617+xo2tv5DF4M38emK7XpLR/ILLFiAiIHyRAdw9+wB80OEzek+bihwHWCs\n" \
         "WU0inAJ7gBLRqv7MHhPP4+XBbeizpLblPdBVVL1az5I3oDptpemIikAZrA37ZAH/\n" \
         "shk9C/wGogiQC4p60LmxbzI/+eYvI2x0M/Xxxpedcq6yRyHb+u+0ziNHoji5M6Qh\n" \
         "kcsailsMqANaN7VcO5NLPT3PzIc6WPG3iVJ0I8iCzXY/QNxOAtWc5t4CyB8+Z+fU\n" \
         "IEk9qAYiidZhpPb1gdJl4LN14qjBqYAmmJAo9oAabujlGmvxKQfR3Mj1FDd1GYab\n" \
         "6QIDAQAB\n" \
         "-----END PUBLIC KEY-----\n";
    #elif TARGET_OS_WATCH
         return @"-----BEGIN PUBLIC KEY-----\n" \
         "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5s2YXfKStHzgUEkY+KDm\n" \
         "yQUMO617+xo2tv5DF4M38emK7XpLR/ILLFiAiIHyRAdw9+wB80OEzek+bihwHWCs\n" \
         "WU0inAJ7gBLRqv7MHhPP4+XBbeizpLblPdBVVL1az5I3oDptpemIikAZrA37ZAH/\n" \
         "shk9C/wGogiQC4p60LmxbzI/+eYvI2x0M/Xxxpedcq6yRyHb+u+0ziNHoji5M6Qh\n" \
         "kcsailsMqANaN7VcO5NLPT3PzIc6WPG3iVJ0I8iCzXY/QNxOAtWc5t4CyB8+Z+fU\n" \
         "IEk9qAYiidZhpPb1gdJl4LN14qjBqYAmmJAo9oAabujlGmvxKQfR3Mj1FDd1GYab\n" \
         "6QIDAQAB\n" \
         "-----END PUBLIC KEY-----\n";
    #endif
    }
    

    Declaration

    Objective-C

    - (NSString *_Nonnull)publicKey;
  • Availability: All.

    Override if required. Return YES if invalid signatures are allowed to apply configuration, or NO if only a correct signature is acceptable.

    It is best practice to make Release builds only allow correct signatures.

    If you do not override this method, the default implementation of allowInvalidSignatures is as follows:

    • for Simulator builds, always returns YES.
    • for Device builds, returns YES if the embedded entitlements file has get-task-allow = true, otherwise returns NO. (Release builds distributed through the App Store, Testflight, Ad Hoc or Enterprise will always have get-task-allow = false).

    Objective-C example

    - (BOOL) allowInvalidSignatures {
    #if DEBUG
       return YES;
    #else
       return NO;
    #endif
    }
    

    Swift example

    @objc override func allowInvalidSignatures() -> Bool {
    #if DEBUG
       return true
    #else
       reutrn false
    #endif
    }
    

    Declaration

    Objective-C

    - (BOOL)allowInvalidSignatures;
  • Availability: All.

    Returns the textual representation of all properties. Property names are shortened to camel case and appended with the value, except for NSString properties which omit the property name. Example: debugLog=5 would be returned as DL=5.

    Declaration

    Objective-C

    - (NSString *_Nonnull)description;
  • Availability: All.

    Returns the textual representation of all properties that have non default values. Property names are shortened to camel case and appended with the non default value, except for NSString properties which omit the property name. Example: userInteractionTimeout=60.0 would be returned as UIT=60.0.

    Declaration

    Objective-C

    - (NSString *_Nonnull)modifications;
  • Availability: All.

    Override if required to set default values into your properties. By default, sets properties as follows: NSString=nil, NSInteger=0, float=0.0, double=0.0, BOOL=NO. You should ensure that all reset values conform to minimum and maximum values, list entries and regular expressions. Any values that are non-conforming will be output to the console.

    Objective-C example

    - (void) reset {
      self.decibelLimit = 5.1;
      self.foregroundColorHex = @"fa3bcc";
    }
    

    Swift example

    @objc override func reset() {
       decibelLimit = 5.1
       foregroundColorHex = "fa3bcc"
    }
    

    Declaration

    Objective-C

    - (void)reset;
  • Availability: iOS only.

    By default Appfigurate uses the vendor identifier to target configuration to a specific device. The vendor identifier is the result of: [[[UIDevice currentDevice] identifierForVendor] UUIDString]

    Instead of the vendor identifier, you may prefer to use an application specific custom identifier that you tie to a specific device. The default value of customIdentifier is nil.

    Objective-C example

    - (NSString* _Nullable) customIdentifier {
       return [KeychainStorage savedCustomerUUID]
    }
    

    Swift example

    @objc override func customIdentifier() -> String? {
       return KeychainStorage.savedCustomerUUID()
    }
    

    Declaration

    Objective-C

    - (NSString *_Nullable)customIdentifier;
  • Availability: iOS automation testing only.

    Converts the current state of the APLConfiguration instance into a string that can be passed as launch arguments to the app when launched as UI automation test. The -[APLConfiguration allowInvalidSignatures] method in the app must return YES for this configuration to be applied.

    Objective-C example

    - (void)setUp {
      [super setUp];
      Configuration* c = [Configuration new];
      c.webserviceURL = "https://localhost:443/api";       // change URL to dummy server
      XCUIApplication* app = [XCUIApplication new];
      app.launchArguments = [c automationLaunchArguments]; // convert to launch argument
      [app launch];                                        // launch app under test
    }
    

    Swift example

    func setUp() {
       super.setUp()
       let c = Configuration()
       c.webserviceURL = "https://localhost:443/api"       // change URL to dummy server
       let app = XCUIApplication()
       app.launchArguments = c.automationLaunchArguments() // convert to launch argument
       app.launch()                                        // launch app under test
    }
    

    Declaration

    Objective-C

    - (NSArray<NSString *> *_Nonnull)automationLaunchArguments;