Commit 35b5ab49 authored by 翟国钧's avatar 翟国钧

增加了对pv事件参数的防御性处理

parent 3f1433a5
......@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "GMPhobos"
s.version = "0.1.0"
s.version = "0.1.1"
s.summary = "GM statistic data sdk"
# This description is used to generate tags and improve search results.
......@@ -26,7 +26,7 @@ Pod::Spec.new do |s|
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT'
s.author = { "licong" => "licong@gmei.com" }
s.source = { :git => "http://git.gengmei.cc/gengmeiios/GMPhobos.git", :tag => "0.1.0" }
s.source = { :git => "http://git.gengmei.cc/gengmeiios/GMPhobos.git", :tag => "0.1.1" }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.platform = :ios, '7.0'
......
......@@ -28,6 +28,7 @@ static NSString *sdkVersion = @"110";
@property (strong, nonatomic) NSString *sessionId;
@property (strong, nonatomic) NSString *pageName;
@property (strong, nonatomic) NSString *refererPageName;
@property (strong, nonatomic) NSString *pageEnterTime;
@property (strong, nonatomic) NSString *pageExitTime;
@property (strong, nonatomic) NSMutableDictionary *pageEnterParam;
......@@ -218,11 +219,16 @@ static NSString *sdkVersion = @"110";
#pragma - mark pv
- (void)onPageStart:(NSString *)pageName businessId:(NSString *)businessId referer:(NSString *)refererPageName{
self.businessId = [self isNonEmpty:businessId] ? businessId : @"";
self.refererPageName = [self isNonEmpty:refererPageName] ? refererPageName : @"";
if (![self isNonEmpty:pageName]) {
return;
}
double enterTime = [[NSDate date] timeIntervalSince1970];
_pageEnterParam = [NSMutableDictionary dictionaryWithObjectsAndKeys:
pageName,@"page_name",
businessId,@"business_id",
refererPageName,@"referer",
self.businessId,@"business_id",
self.refererPageName,@"referer",
@(enterTime),@"in",nil];
}
......@@ -384,6 +390,17 @@ static NSString *sdkVersion = @"110";
}
}
- (BOOL)isNonEmpty:(NSString *)string {
NSMutableCharacterSet *emptyStringSet = [[NSMutableCharacterSet alloc] init];
[emptyStringSet formUnionWithCharacterSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
[emptyStringSet formUnionWithCharacterSet: [NSCharacterSet characterSetWithCharactersInString: @" "]];
if ([string length] == 0) {
return NO;
}
NSString* str = [string stringByTrimmingCharactersInSet:emptyStringSet];
return [str length] > 0;
}
- (void)dealloc{
if (self) {
......
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