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.

  • Initializes the Pyze library. Call this method in the app delegate’s method application:willFinishLaunchingWithOptions. Get Pyze App Key from growth.pyze.com Include the ‘Pyze App Key’ in application’s Info.plist with key name ‘PYZE_APP_KEY’

    Usage:

     [Pyze initialize: PyzelogLevelMinimal];
    

    Warning

    Important: Get an app-specific key from growth.pyze.com asn save in info

    Since

    2.0.5

    Declaration

    Objective-C

    + (void)initializeWithLogLevel:(PyzeLogLevel)logLevel;

    Swift

    class func initializeWithLogLevel(logLevel: PyzeLogLevel)

    Parameters

    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
  • Returns the Pyze instance identifier. If Pyze not initialized, returns an empty string.

    Declaration

    Objective-C

    + (NSString *)getPyzeAppInstanceId;

    Swift

    class func getPyzeAppInstanceId() -> String!

    Return Value

    Pyze Instance identifier

  • 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

  • Will stop collecting all data *
  • - parameter: shouldOptout Boolean value to decide if data tracking should be stopped. *
  • Since

    5.0.2

    Declaration

    Objective-C

    + (void)setUserOptOut:(BOOL)shouldOptout;

    Swift

    class func setUserOptOut(shouldOptout: Bool)

    Parameters

    shouldOptout

    Boolean value to decide if data tracking should be stopped.

  • Will stop collecting all data and delete existing data from the server *
  • - parameter: shouldDelete Boolean value to decide if data collection should be stopped and delete existing data from the server *
  • Since

    5.0.2

    Declaration

    Objective-C

    + (void)deleteUser:(BOOL)shouldDelete;

    Swift

    class func deleteUser(shouldDelete: Bool)

    Parameters

    shouldDelete

    Boolean value to decide if data collection should be stopped and delete existing data from the server

  • 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: NSData!)

    Parameters

    deviceToken

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

  • 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:. The method accepts the token as NSStirng.

    Since

    5.0.1

    Declaration

    Objective-C

    + (void)setRemoteNotificationDeviceTokenString:(NSString *)deviceToken;

    Swift

    class func setRemoteNotificationDeviceTokenString(deviceToken: String!)

    Parameters

    deviceToken

    Device token string recieved.

    • 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: [NSObject : AnyObject]!)

    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 processReceivedRemoteNotificationWithId(identifer: String!, withUserInfo userInfo: [NSObject : AnyObject]!)

    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 getMessagesForType(messageType: PyzeInAppMessageType, withCompletionHandler completionHandler: (([AnyObject]!) -> 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 getMessageHeadersForType(messageType: PyzeInAppMessageType, withCompletionHandler completionHandler: (([AnyObject]!) -> 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 getMessageBodyWithCampaignID(cid: String!, andMessageID messageID: String!, withCompletionHandler completionHandler: (([NSObject : AnyObject]!) -> Void)!)

    Parameters

    cid

    campaign ID

    messageID

    message ID

    completionHandler

    Completion handler will be called with message body.