|
@@ -15,6 +15,8 @@
|
|
|
#import "OLDataProvider.h"
|
|
#import "OLDataProvider.h"
|
|
|
#import "AFHTTPSessionManager.h"
|
|
#import "AFHTTPSessionManager.h"
|
|
|
#import "SelectUploadOrderViewController.h"
|
|
#import "SelectUploadOrderViewController.h"
|
|
|
|
|
+#import "iSalesDB.h"
|
|
|
|
|
+#import "iSalesNetwork.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
#define UNZIP_OPEN_FAILED 0
|
|
#define UNZIP_OPEN_FAILED 0
|
|
@@ -428,10 +430,97 @@
|
|
|
//// // Only allow portrait (standard behaviour)
|
|
//// // Only allow portrait (standard behaviour)
|
|
|
// return UIInterfaceOrientationMaskAll;
|
|
// return UIInterfaceOrientationMaskAll;
|
|
|
//}
|
|
//}
|
|
|
|
|
+
|
|
|
|
|
+void UncaughtExceptionHandler(NSException *exception) {
|
|
|
|
|
+
|
|
|
|
|
+ NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
|
|
|
|
|
+ NSString* build =[infoDict objectForKey:@"CFBundleVersion"];
|
|
|
|
|
+ NSString* version =[infoDict objectForKey:@"CFBundleShortVersionString"];
|
|
|
|
|
+ NSString *versionNum = @"";
|
|
|
|
|
+#ifdef BUILD_NPD
|
|
|
|
|
+ versionNum = [NSString stringWithFormat:@"Version: npd %@ Build %@",version,build];
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+#ifdef BUILD_HMLG
|
|
|
|
|
+ versionNum = [NSString stringWithFormat:@"Version: HOMELEGANCE %@ Build %@",version,build];
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+ versionNum = [versionNum stringByReplacingOccurrencesOfString:@"'" withString:@"''"];
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取异常崩溃信息
|
|
|
|
|
+ */
|
|
|
|
|
+ NSArray *callStack = [exception callStackSymbols];
|
|
|
|
|
+ NSString *reason = [exception reason];
|
|
|
|
|
+ NSString *name = [exception name];
|
|
|
|
|
+ NSString *content = [NSString stringWithFormat:@"异常错误报告\n exception_name: %@\n exception_reason: \n%@ \n exception_callStackSymbols: \n%@ \n",name,reason,[callStack componentsJoinedByString:@"\n"]];
|
|
|
|
|
+
|
|
|
|
|
+ content = [content stringByReplacingOccurrencesOfString:@"'" withString:@"''"];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"insert into errlog (errmsg,params) values ('%@','%@');",versionNum,content];
|
|
|
|
|
+
|
|
|
|
|
+ [iSalesDB execSql:sql];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)handleErrorLog {
|
|
|
|
|
+
|
|
|
|
|
+ __block NSMutableArray *err_array = [NSMutableArray array];
|
|
|
|
|
+ [iSalesDB jk_query:@"select errmsg,params,create_time from errlog;" completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
|
|
|
|
|
+
|
|
|
|
|
+ const char *version_char = (char *)sqlite3_column_text(stmt, 0);
|
|
|
|
|
+ const char *errlog_char = (char *)sqlite3_column_text(stmt, 1);
|
|
|
|
|
+ const char *dateTime_char = (char *)sqlite3_column_text(stmt, 2);
|
|
|
|
|
+
|
|
|
|
|
+ if (version_char == NULL)
|
|
|
|
|
+ version_char = "";
|
|
|
|
|
+ if (errlog_char == NULL)
|
|
|
|
|
+ errlog_char = "";
|
|
|
|
|
+ if (dateTime_char == NULL)
|
|
|
|
|
+ dateTime_char = "";
|
|
|
|
|
+
|
|
|
|
|
+ NSString *version_str = [NSString stringWithUTF8String:version_char];
|
|
|
|
|
+ NSString *errlog_str = [NSString stringWithUTF8String:errlog_char];
|
|
|
|
|
+ NSString *dateTime_str = [NSString stringWithUTF8String:dateTime_char];
|
|
|
|
|
+
|
|
|
|
|
+ NSDictionary *err_dic = @{
|
|
|
|
|
+ @"version" : version_str,
|
|
|
|
|
+ @"errlog" : errlog_str,
|
|
|
|
|
+ @"time" : dateTime_str
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ [err_array addObject:err_dic];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+ if (err_array.count) {
|
|
|
|
|
+ // 首先上传
|
|
|
|
|
+ for (NSDictionary *err_dic in err_array) {
|
|
|
|
|
+
|
|
|
|
|
+ NSString *version = [err_dic objectForKey:@"version"];
|
|
|
|
|
+ NSString *errlog = [err_dic objectForKey:@"errlog"];
|
|
|
|
|
+ NSString *time = [err_dic objectForKey:@"time"];
|
|
|
|
|
+
|
|
|
|
|
+ NSString *result = [NSString stringWithFormat:@"version: %@ \n crash_datetime: %@ \n",version,time];
|
|
|
|
|
+
|
|
|
|
|
+ [iSalesNetwork err_log:errlog result:result module:@"crash" code:0];
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //上传完成之后清表
|
|
|
|
|
+ [iSalesDB execSql:@"delete from errlog"];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
|
{
|
|
{
|
|
|
- [DefaultAppearance init_appearance];
|
|
|
|
|
|
|
+ NSSetUncaughtExceptionHandler(&UncaughtExceptionHandler);
|
|
|
|
|
|
|
|
|
|
+ [DefaultAppearance init_appearance];
|
|
|
|
|
|
|
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
|
|
NSString *cachefolder = [paths objectAtIndex:0];
|
|
NSString *cachefolder = [paths objectAtIndex:0];
|
|
@@ -557,6 +646,9 @@
|
|
|
// [self test_descrypt1];
|
|
// [self test_descrypt1];
|
|
|
//UILabel * appearanceLabel = [UILabel appearanceWhenContainedIn:uialertcontroller.class, nil];
|
|
//UILabel * appearanceLabel = [UILabel appearanceWhenContainedIn:uialertcontroller.class, nil];
|
|
|
// [appearanceLabel setAppearanceFont:[UIFont boldSystemFontOfSize:10]]; //for example
|
|
// [appearanceLabel setAppearanceFont:[UIFont boldSystemFontOfSize:10]]; //for example
|
|
|
|
|
+
|
|
|
|
|
+ [self handleErrorLog];
|
|
|
|
|
+
|
|
|
return YES;
|
|
return YES;
|
|
|
}
|
|
}
|
|
|
//-(void)test_descrypt
|
|
//-(void)test_descrypt
|