Pyze

@interface Pyze : NSObject

Pyze main class

This is the main class for the Pyze iOS SDK. Use method initializeWithKey: to initialize the Library. For troubleshooting during development and in debug mode, you can throttle the logging level using method debugLogThrottling: In the release mode or deployment the SDK will log minimally.

Please visit Pyze Developer Center for more information.

You will need an app-specific key Pyze App Key from: growth.pyze.com

  • Initializes the Pyze library. Call this method in the app delegate’s method application:willFinishLaunchingWithOptions. Get Pyze App Key from growth.pyze.com

    Usage:

      [Pyze initialize:@"Pyze App Key obtained from growth.pyze.com"];
    

    Warning

    Important: Get an app-specific key from growth.pyze.com

    Since

    v3.0.5

    Declaration

    Objective-C

    + (void)initialize:(NSString *)pyzeAppKey;

    Swift

    class func initialize(_ pyzeAppKey: String!)

    Parameters

    pyzeAppKey

    The app-specific key obtained from growth.pyze.com

  • Initializes the Pyze library and specify the log throttling level. Call this method in the app delegate’s method application:willFinishLaunchingWithOptions. Get Pyze App Key from growth.pyze.com

    Usage:

      [Pyze initialize:@"Pyze App Key obtained from growth.pyze.com"   withLogThrottling: PyzelogLevelAll];
    

    Warning

    Important: Get an app-specific key from growth.pyze.com

    Since

    v3.0.5 (added for consistency with Android and Unity agents)

    Declaration

    Objective-C

    + (void)initialize:(NSString *)pyzeAppKey
        withLogThrottling:(PyzeLogLevel)logLevel;

    Swift

    class func initialize(_ pyzeAppKey: String!, withLogThrottling logLevel: PyzeLogLevel)

    Parameters

    pyzeAppKey

    The app-specific key obtained from growth.pyze.com

    logLevel

    Log level you would wish to see in the console.

  • Log throttling level can be changed anytime in the app

    How to use:

    [Pyze logThrottling:PyzelogLevelMinimal];
    

    or

    [Pyze logThrottling:PyzelogLevelErrors];
    

    Since

    v3.0.5

    Declaration

    Objective-C

    + (void)logThrottling:(PyzeLogLevel)logLevel;

    Swift

    class func logThrottling(_ logLevel: PyzeLogLevel)

    Parameters

    logLevel

    Log level you would wish to see in the console.

  • Pyze Timer Reference is a time interval since a Pyze internal reference time in seconds with millisecond precision e.g. 6.789 seconds (or 6789 milliseconds)

    It is used to time tasks and report in events.

    usage:

     //Start timing
     double referenceFileUploadStart = [Pyze timerReference];
     ...
     ...
     //time and send elapsedSeconds
     [PyzeCustomEvent postWithEventName:@“File Uploaded”
                     withTimerReference:referenceFileUploadStart];
    

    Declaration

    Objective-C

    + (double)timerReference;

    Swift

    class func timerReference() -> Double
  • Hash function can be used to convert any NSString to an hashed equivalent. The generated string is suffixed with two hash characters ## This function is useful to avoid collecting any information that may be private or sensitive.

    Since

    3.2.1

    Declaration

    Objective-C

    + (NSString *)hash:(NSString *)stringToHash;

    Swift

    class func hash(_ stringToHash: String!) -> String!

    Parameters

    stringToHash

    String to Hash

  • Use this API to set the push notification device token. This will trigger Pyze to update the device token, which internally would be used to send the push notification. Call this API in Application’s AppDelegate method application:didRegisterForRemoteNotificationsWithDeviceToken:.

    Since

    3.2.1

    Declaration

    Objective-C

    + (void)setRemoteNotificationDeviceToken:(NSData *)deviceToken;

    Swift

    class func setRemoteNotificationDeviceToken(_ deviceToken: Data!)

    Parameters

    deviceToken

    device Token bytes received from the AppDelegate’s method call.

    • Use this API to process the push/remote notification. Call this everytime when you receive the remote notification from application:didReceiveRemoteNotification or application:didReceiveRemoteNotification:fetchCompletionHandler:.

    If you are using interactive push notifications e.g. Button handlers in push messages, then use processReceivedRemoteNotificationWithId: instead.

  • Since

    3.2.1

  • Declaration

    Objective-C

    + (void)processReceivedRemoteNotification:(NSDictionary *)userInfo;

    Swift

    class func processReceivedRemoteNotification(_ userInfo: [AnyHashable : Any]!)

    Parameters

    userInfo

    User information received as a payload.

  • Use this API to process the local/remote push notifications. Call this everytime when you receive the remote notification from application:handleActionWithIdentifier:forRemoteNotification:completionHandler:. For example: Button handlers in interactive push notifications. If you are not using button handlers in push messages, you can pass nil to ‘identifer’ parameter.

  • Since

    3.2.1

  • Declaration

    Objective-C

    + (void)processReceivedRemoteNotificationWithId:(NSString *)identifer
                                       withUserInfo:(NSDictionary *)userInfo;

    Swift

    class func processReceivedRemoteNotification(withId identifer: String!, withUserInfo userInfo: [AnyHashable : Any]! = [:])

    Parameters

    userInfo

    User information received as a payload.

  • Returns the messageHeaders and messageBody from the server and from the cache based on the messageType.

    Since

    3.2.1

    Declaration

    Objective-C

    + (void)getMessagesForType:(PyzeInAppMessageType)messageType
         withCompletionHandler:(void (^)(NSArray *))completionHandler;

    Swift

    class func getMessagesFor(_ messageType: PyzeInAppMessageType, withCompletionHandler completionHandler: (([Any]?) -> Void)!)

    Parameters

    messageType

    Message type for in-app messages.

    completionHandler

    Completion handler will be called with result.

  • Returns the number of unread messages from the server.

    Since

    3.2.1

    Declaration

    Objective-C

    + (void)countNewUnFetched:(void (^)(NSInteger))completionHandler;

    Swift

    class func countNewUnFetched(_ completionHandler: ((Int) -> Void)!)

    Parameters

    completionHandler

    Completion handler will be called with count.

  • Get NSArray of message headers containing message ID and content ID.

    Since

    3.2.1

    Declaration

    Objective-C

    + (void)getMessageHeadersForType:(PyzeInAppMessageType)messageType
               withCompletionHandler:(void (^)(NSArray *))completionHandler;

    Swift

    class func getMessageHeaders(for messageType: PyzeInAppMessageType, withCompletionHandler completionHandler: (([Any]?) -> Void)!)

    Parameters

    messageType

    Message type for in-app messages.

    completionHandler

    Completion handler will be called with result.

  • Get message details with Campaign ID and message ID received from ‘getMessageHeadersForType’.

    Since

    3.2.1

    Declaration

    Objective-C

    + (void)getMessageBodyWithCampaignID:(NSString *)cid
                            andMessageID:(NSString *)messageID
                   withCompletionHandler:
                       (void (^)(NSDictionary *))completionHandler;

    Swift

    class func getMessageBody(withCampaignID cid: String!, andMessageID messageID: String!, withCompletionHandler completionHandler: (([AnyHashable : Any]?) -> Void)!)

    Parameters

    cid

    campaign ID

    messageID

    message ID

    completionHandler

    Completion handler will be called with message body.