iOS client development

更新时间:
复制 MD 格式

Important

As of June 28, 2020, mPaaS no longer provides maintenance for the 10.1.32 baseline. Use the 10.1.68 or 10.1.60 baselines. To upgrade your baseline, see the mPaaS 10.1.68 Upgrade Guide or the mPaaS 10.1.60 Upgrade Guide.

This topic describes how to develop an iOS client and covers the following tasks:

  1. Integrate the Mobile Analysis component

  2. Record event logs

1. Integrate the Mobile Analysis component

To integrate the Mobile Analysis component, see the iOS integration document.

2. Record event logs

This section provides an example of how to record event logs using SDK V10.1.68.

Sample code

#import <MPMasAdapter/MPMasAdapter.h>

// actionId supports only KActionID_Event. You can ignore this parameter.
NSString * actionId = KActionID_Event;
// Event ID
NSString * eventId = @"PayResults";
// Add properties
NSMutableDictionary * extParam = [NSMutableDictionary dictionary];
// Property: Payment time. The key is the property ID. The value is the property value.
[extParam setObject:@"2017-05-01 12:03:16" forKey:@"pay_time"];
// Property: User ID
[extParam setObject:@"the-userId" forKey:@"user_id"];
// Property: Payment method
[extParam setObject:@"alipay" forKey:@"payment_method"];

// Print the log
[MPRemoteLoggingInterface writeLogWithActionId:actionId eventId:eventId extParam:extParam];

Parameter description

Parameter

Description

eventId

The event ID. It is the unique identifier for an event. For more information, see Tutorial scenarios.

extParam

Event properties. The extParam parameter is of the NSDictionary type and stores properties associated with the event:

  • Key: The property ID. For more information, see Tutorial scenarios.

  • Value: The property value. The value is stored as a string on the client. For analysis, the server-side can automatically convert the value to a string, integer, or floating-point type.

Related links