Commit 4a9dd7a3 authored by 翟国钧's avatar 翟国钧

Phobos的所有埋点方法由原来的实例方法改成静态方法。

parent 89abe3e5
...@@ -46,26 +46,33 @@ This singleton instance is often configured in your app delegate’s application ...@@ -46,26 +46,33 @@ This singleton instance is often configured in your app delegate’s application
} }
``` ```
If you would like to specify a user, you can set the userId that is used with the -[setUserId:] class method. If you would like to specify a user, you can set the userId that is used with the -[setUserId:] Instance method.
```objc ```objc
WMUser *user = [[WMLoginManager shareInstance] user]; WMUser *user = [[WMLoginManager shareInstance] user];
[client setUserId:user.userId]; [client setUserId:user.userId];
``` ```
If you would like to use Phobos, you must set the currentCityId that is used with the -[setCurrentCityId:] Instance method.
```objc
WMCityObject *city = [[WMCacheService sharedInstance] fetchObjectAtDucmentPathWithkey:kCurrentCity];
if (city) {
[client setCurrentCityId:city.id];
}
```
## Sending Messages ## Sending Messages
Sending a basic message: Sending a basic message:
```objc ```objc
[[Phobos sharedClient] track:@"event_id"]; [Phobos track:@"event_id"];
``` ```
Sending a message with another attributes: Sending a message with another attributes:
```objc ```objc
[[Phobos sharedClient] track:@"event_id" attributes:@{}]; [Phobos track:@"event_id" attributes:@{}];
``` ```
Sending a message with another attributes and send immediately: Sending a message with another attributes and send immediately:
```objc ```objc
[[Phobos sharedClient] track:@"event_id" attributes:@{} sendNow:YES]; [Phobos track:@"event_id" attributes:@{} sendNow:YES];
``` ```
......
  • 另外,因为埋点数据中需要用户的当前城市信息,所以在初始化Phobos的时候,必须通过setCurrentCityId方法来设置城市ID

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment