Pgyer document center

iOS SDK Integration

Registration application and get App ID

App ID: uniquely identifies an app ID, each App has a unique App ID, the developer on the pgyer can find it in the Application Manager Home page.

App ID

Adding Framework by Cocoapods

pod 'Pgyer'
pod 'PgyUpdate'

Manually add Framework

Download pgyer’s SDK (contains the application usage statistics, exception reporting, user feedback, check for updates)。

1. Add PgySDK.framework, PgyUpdate.framework.

The PgySDK.framework PgyUpdate.framework anpd drag it to your project in Xcode, and check the "Copy items if needed".

Add framework

2. Configure dependencies

After importing the SDK, switch to the Build Phases tab, add the following six systems in the framework of the Link Binary With Libraries:

CoreTelephony.framework
OpenGLES.framework
CoreMotion.framework
AudioToolbox.framework
AvFoundation.framework
SystemConfiguration.framework

Add dependencies

If only update checking, you do not need to add dependencies.

Initialization and call the SDK

Introduced header files in the AppDelegate.m of project file:

#import <PgySDK/PgyManager.h>
#import <PgyUpdate/PgyUpdateManager.h>

In the application: didFinishLaunchingWithOptions call SDK:

//Start the basic SDK
[[PgyManager sharedPgyManager] startManagerWithAppId:@"PGY_APP_ID"];
//Start checking update SDK
[[PgyUpdateManager sharedPgyManager] startManagerWithAppId:@"PGY_APP_ID"];

PGY_APP_ID is equal to App id you get in Pgyer.

Automatic exception reporting Crash

After calling the SDK, users use App crash information in the process will be sent to the Pgyer. Pgyer will count the number of errors that occur and users that impacted. Meanwhile developers can also view the details of the crash in web,including error stacks, models, etc., to help developers quickly locate the error.

Pgyer shows the error has not been symbolized before, if you need to view symbolic information through the stack, you need submit the code corresponding dSYM on Pgyer.

Notice: If you use the Xcode startup program, gdb / lldb will block the signal and stop the application from running during local debugging, so the crash information during debugging will not be uploaded to the Pgyer.

Manual reporting exception

In addition to automatic reporting Crash which cause an exception in SDK, the developer can also manually reported Exception.

- (void)reportException
{
    @try {
        NSArray *array = [NSArray arrayWithObjects:@"", nil];
        NSString *value = [array objectAtIndex:10];
    }
    @catch (NSException *exception) {
        [[PgyManager sharedPgyManager] reportException:exception];
    }
}

User Feedback

Call the SDK, the default open user feedback function, the user can shake or three fingers to slide up to activate the user feedback function.

shake

1、Turn off user feedback (default on):

[[PgyManager sharedPgyManager] setEnableFeedback:NO];

2、Customize user feedback activation mode (default is shake):

// Set the user feedback interface activation mode for the three fingers drag
[[PgyManager sharedPgyManager] setFeedbackActiveType:kPGYFeedbackActiveTypeThreeFingersPan];

// Set the user feedback interface to activate the way to shake
[[PgyManager sharedPgyManager] setFeedbackActiveType:kPGYFeedbackActiveTypeShake];

The above customizations must be set before[[PgyManager sharedPgyManager] startManagerWithAppId:@"PGY_APP_ID"]

3、Customize user interface style

Developers can change the interface style by setting the color theme of the user feedback interface. The color after setting will affect the background color of the Title and the border color of the recording button. The default is 0x37C5A1 (green).

[[PgyManager sharedPgyManager] setThemeColor:[UIColor blackColor]];

4、Custom shake shake sensitivity

Developers can customize the shake sensitivity, the default is 2.3, the smaller the value the higher the sensitivity.

[[PgyManager sharedPgyManager] setShakingThreshold:3.0];

5、In addition to using the "shake" and "three fingers drag" to activate user feedback, developers can also directly through the code to activate user feedback function:

[[PgyManager sharedPgyManager] showFeedbackView];

Check updates

Pgyer provides developers with the function of checking the version update. When this feature is enabled, if developers submits a new version on the Pgyer, the old version can pop up an update prompt to prompt the user to update to the latest version. The version update function is turned on as follows:

Include the header file in the file that needs to be checked for updates:

#import <PgyUpdate/PgyUpdateManager.h>

Then call it

[[PgyUpdateManager sharedPgyManager] startManagerWithAppId:@"PGY_APP_ID"];   // Replace PGY_APP_ID with the App's App ID
[[PgyUpdateManager sharedPgyManager] checkUpdate];

If there is a newer version will prompt the user to update, as shown:

version update

If you need to customize the check update, you need to call

[[PgyUpdateManager sharedPgyManager] checkUpdateWithDelegete:self selector:@selector(updateMethod:)];

Where updateMethod checks the updated callback method. If there is a new version, the dictionary containing the new version information will be returned, otherwise the dictionary is nil. If you want to update the new version, you can call

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:response[@"downloadURL"]]];

After processing the update information, you can call

[[PgyUpdateManager sharedPgyManager] updateLocalBuildNumber];

to update the local stored Pgyer's Build number. After the local build number is updated, the SDK will treat the local version as up-to-date. The update method for the current version invocation will no longer return the update information.