Commit d81144b0 authored by 翟国钧's avatar 翟国钧

增加了对H5埋点的处理

parent c5b37c3b
...@@ -28,7 +28,7 @@ PODS: ...@@ -28,7 +28,7 @@ PODS:
- GMLibrary/Network (0.0.1): - GMLibrary/Network (0.0.1):
- AFNetworking (~> 2.6.1) - AFNetworking (~> 2.6.1)
- GMLibrary/Cache (~> 0.0.1) - GMLibrary/Cache (~> 0.0.1)
- GMPhobos (0.0.4): - GMPhobos (0.0.6):
- GMLibrary (~> 0.0.1) - GMLibrary (~> 0.0.1)
- TMCache (2.1.0) - TMCache (2.1.0)
...@@ -37,12 +37,12 @@ DEPENDENCIES: ...@@ -37,12 +37,12 @@ DEPENDENCIES:
EXTERNAL SOURCES: EXTERNAL SOURCES:
GMPhobos: GMPhobos:
:path: "../" :path: ../
SPEC CHECKSUMS: SPEC CHECKSUMS:
AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60 AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60
GMLibrary: c31039ad32bc93f866d6c3052c20acb8cf9c1568 GMLibrary: c31039ad32bc93f866d6c3052c20acb8cf9c1568
GMPhobos: 6b6634d1c84b19272c74f068e59d847528dab943 GMPhobos: 99ff08c5770ebb1a8c15579a2e0ac260a24ea386
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
COCOAPODS: 0.39.0 COCOAPODS: 0.39.0
{ {
"name": "GMPhobos", "name": "GMPhobos",
"version": "0.0.4", "version": "0.0.6",
"summary": "GM statistic data sdk", "summary": "GM statistic data sdk",
"description": "GM statistic data sdk.", "description": "GM statistic data sdk.",
"homepage": "http://git.gengmei.cc/gengmeiios/GMPhobos", "homepage": "http://git.gengmei.cc/gengmeiios/GMPhobos",
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
}, },
"source": { "source": {
"git": "http://git.gengmei.cc/gengmeiios/GMPhobos.git", "git": "http://git.gengmei.cc/gengmeiios/GMPhobos.git",
"tag": "0.0.4" "tag": "0.0.6"
}, },
"platforms": { "platforms": {
"ios": "7.0" "ios": "7.0"
......
...@@ -28,7 +28,7 @@ PODS: ...@@ -28,7 +28,7 @@ PODS:
- GMLibrary/Network (0.0.1): - GMLibrary/Network (0.0.1):
- AFNetworking (~> 2.6.1) - AFNetworking (~> 2.6.1)
- GMLibrary/Cache (~> 0.0.1) - GMLibrary/Cache (~> 0.0.1)
- GMPhobos (0.0.4): - GMPhobos (0.0.6):
- GMLibrary (~> 0.0.1) - GMLibrary (~> 0.0.1)
- TMCache (2.1.0) - TMCache (2.1.0)
...@@ -37,12 +37,12 @@ DEPENDENCIES: ...@@ -37,12 +37,12 @@ DEPENDENCIES:
EXTERNAL SOURCES: EXTERNAL SOURCES:
GMPhobos: GMPhobos:
:path: "../" :path: ../
SPEC CHECKSUMS: SPEC CHECKSUMS:
AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60 AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60
GMLibrary: c31039ad32bc93f866d6c3052c20acb8cf9c1568 GMLibrary: c31039ad32bc93f866d6c3052c20acb8cf9c1568
GMPhobos: 6b6634d1c84b19272c74f068e59d847528dab943 GMPhobos: 99ff08c5770ebb1a8c15579a2e0ac260a24ea386
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
COCOAPODS: 0.39.0 COCOAPODS: 0.39.0
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
buildForArchiving = "YES"> buildForArchiving = "YES">
<BuildableReference <BuildableReference
BuildableIdentifier = 'primary' BuildableIdentifier = 'primary'
BlueprintIdentifier = '3F46E2460B75C801A4818A9B' BlueprintIdentifier = '22972869A84C7597A0E65FB2'
BlueprintName = 'GMPhobos' BlueprintName = 'GMPhobos'
ReferencedContainer = 'container:Pods.xcodeproj' ReferencedContainer = 'container:Pods.xcodeproj'
BuildableName = 'GMPhobos.framework'> BuildableName = 'GMPhobos.framework'>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.0.4</string> <string>0.0.6</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "GMPhobos" s.name = "GMPhobos"
s.version = "0.0.5" s.version = "0.0.6"
s.summary = "GM statistic data sdk" s.summary = "GM statistic data sdk"
# This description is used to generate tags and improve search results. # This description is used to generate tags and improve search results.
...@@ -26,7 +26,7 @@ Pod::Spec.new do |s| ...@@ -26,7 +26,7 @@ Pod::Spec.new do |s|
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT' s.license = 'MIT'
s.author = { "licong" => "licong@gmei.com" } s.author = { "licong" => "licong@gmei.com" }
s.source = { :git => "http://git.gengmei.cc/gengmeiios/GMPhobos.git", :tag => "0.0.5" } s.source = { :git => "http://git.gengmei.cc/gengmeiios/GMPhobos.git", :tag => "0.0.6" }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.platform = :ios, '7.0' s.platform = :ios, '7.0'
......
...@@ -57,5 +57,16 @@ ...@@ -57,5 +57,16 @@
- (void)track:(NSString *)eventId; - (void)track:(NSString *)eventId;
- (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes; - (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes;
- (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow; - (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow;
/**
* @author 翟国钧, 16-02-03 16:02:30
*
* @brief H5调用的埋点方法
*
* @param jsonString h5传过来的参数
*
* @since 0.0.1
*/
- (void)trackJsEvent:(NSString *)jsonString;
@end @end
...@@ -195,6 +195,29 @@ static NSString *sdkVersion = @"110"; ...@@ -195,6 +195,29 @@ static NSString *sdkVersion = @"110";
} }
} }
- (void)trackJsEvent:(NSString *)jsonString{
@try {
NSData *data = [jsonString dataUsingEncoding:NSUnicodeStringEncoding];
NSMutableDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
id pa = dict[@"params"];
NSDictionary *json;
if ([pa isKindOfClass:[NSString class]]) {
NSError *jsonError;
NSData *objectData = [pa dataUsingEncoding:NSUTF8StringEncoding];
json = [NSJSONSerialization JSONObjectWithData:objectData
options:NSJSONReadingMutableContainers
error:&jsonError];
[self track:dict[@"type"] attributes:json];
}else{
[self track:dict[@"type"]];
}
}
@catch (NSException *exception) {
phobosLog(exception);
}
}
/** /**
* @brief 将埋点时间封装成词典数据 * @brief 将埋点时间封装成词典数据
......
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