Authored by ZhouRongjun

增加错误信息回调给app。Review by 朱小军。

... ... @@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
0928E56C1E8D3824008FD4F3 /* YHPatch.m in Sources */ = {isa = PBXBuildFile; fileRef = 0928E56B1E8D3824008FD4F3 /* YHPatch.m */; };
194EDC761A7F52D100421E6C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 194EDC751A7F52D100421E6C /* main.m */; };
194EDC791A7F52D100421E6C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 194EDC781A7F52D100421E6C /* AppDelegate.m */; };
194EDC7C1A7F52D100421E6C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 194EDC7B1A7F52D100421E6C /* ViewController.m */; };
... ... @@ -101,6 +102,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0928E56A1E8D3824008FD4F3 /* YHPatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHPatch.h; sourceTree = "<group>"; };
0928E56B1E8D3824008FD4F3 /* YHPatch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHPatch.m; sourceTree = "<group>"; };
194EDC701A7F52D100421E6C /* YH_Analytics.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YH_Analytics.app; sourceTree = BUILT_PRODUCTS_DIR; };
194EDC741A7F52D100421E6C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
194EDC751A7F52D100421E6C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
... ... @@ -463,18 +466,20 @@
E7ADAE321AB946C100C9DD0B /* Model */ = {
isa = PBXGroup;
children = (
E7ADAE441AB9487A00C9DD0B /* YHAnalyItemData.h */,
E7ADAE451AB9487A00C9DD0B /* YHAnalyItemData.m */,
E7ADAE331AB946C100C9DD0B /* YHDevice.h */,
E7ADAE341AB946C100C9DD0B /* YHDevice.m */,
E7ADAE351AB946C100C9DD0B /* YHError.h */,
E7ADAE361AB946C100C9DD0B /* YHError.m */,
E7ADAE371AB946C100C9DD0B /* YHEvent.h */,
E7ADAE381AB946C100C9DD0B /* YHEvent.m */,
E7ADAE391AB946C100C9DD0B /* YHStatus.h */,
E7ADAE3A1AB946C100C9DD0B /* YHStatus.m */,
0928E56A1E8D3824008FD4F3 /* YHPatch.h */,
0928E56B1E8D3824008FD4F3 /* YHPatch.m */,
E7A908711BB3C4B000E2EA39 /* YHPerformance.h */,
E7A908721BB3C4B000E2EA39 /* YHPerformance.m */,
E7ADAE441AB9487A00C9DD0B /* YHAnalyItemData.h */,
E7ADAE451AB9487A00C9DD0B /* YHAnalyItemData.m */,
E7ADAE391AB946C100C9DD0B /* YHStatus.h */,
E7ADAE3A1AB946C100C9DD0B /* YHStatus.m */,
);
path = Model;
sourceTree = "<group>";
... ... @@ -693,6 +698,7 @@
E7A908731BB3C4B000E2EA39 /* YHPerformance.m in Sources */,
E7ADAE3B1AB946C100C9DD0B /* YHDevice.m in Sources */,
E79828121AA6A5120035137C /* YH_KeychainStore.m in Sources */,
0928E56C1E8D3824008FD4F3 /* YHPatch.m in Sources */,
194EDC761A7F52D100421E6C /* main.m in Sources */,
E7ADAE5B1AB95BC800C9DD0B /* YHAssemblyAssistant.m in Sources */,
E7ADAE3C1AB946C100C9DD0B /* YHError.m in Sources */,
... ...
... ... @@ -30,6 +30,10 @@
[[YH_Analytics sharedInstance] startWithAppId:@"appid"];
[[YH_Analytics sharedInstance] setCid:@"test cid"];
[YH_Analytics sharedInstance].errorBlock = ^(NSDictionary *dict){
NSLog(@"%@", dict);
};
return YES;
}
... ...
... ... @@ -6,7 +6,8 @@
//
//
#import <YH_Analytics/YH_Analytics.h>
#import <Foundation/Foundation.h>
#import "YHAnalyItemData.h"
@interface YHPatch : YHAnalyItemData
... ...
... ... @@ -15,6 +15,8 @@
@class YHPerformance;
@interface YHAssemblyAssistant : NSObject
@property (copy, nonatomic) void(^errorBlock)(NSDictionary *dict);
+ (instancetype)sharedInstance;
- (BOOL)canPersisting;
... ...
... ... @@ -439,6 +439,11 @@ static dispatch_queue_t persisting_queue() {
[self.immediUploadItemDic removeObjectForKey:JsonKeyDataTypePatch];
[self.immediUploadItemDic setObject:[[NSMutableArray alloc]initWithObjects:error.jsonDictionary, nil] forKey:JsonKeyDataTypeErrors];
//将错误信息回调给应用
if (self.errorBlock) {
self.errorBlock(self.immediUploadItemDic);
}
[[YHNetworkService sharedInstance] uploadLogcustomURL:kURLAnalyticsService2 parameters:self.immediUploadItemDic completionBlock:^(BOOL success, NSError *error) {
if (success) {
YALog(@"upload immedialite error success.");
... ...
... ... @@ -165,5 +165,9 @@ typedef NS_ENUM(NSInteger, YHLogStrategy) {
是否使用https
*/
@property (assign, nonatomic, readonly) BOOL httpsEnable;
/**
返回图片和网络错误的信息
*/
@property (copy, nonatomic) void(^errorBlock)(NSDictionary *dict);
@end
... ...
... ... @@ -398,4 +398,9 @@
_httpsEnable = enable;
}
- (void)setErrorBlock:(void (^)(NSDictionary *))errorBlock
{
[YHAssemblyAssistant sharedInstance].errorBlock = errorBlock;
}
@end
... ...