Browse Source

Add bugly

heavyrain lee 6 years ago
parent
commit
71e04ca206

+ 22 - 0
wfchat/WildFireChat.xcodeproj/project.pbxproj

@@ -68,6 +68,11 @@
 		6E616DB520AB3540002CB8BE /* WebRTC.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 6E616D9F20AB3435002CB8BE /* WebRTC.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		6E616DB720AB3540002CB8BE /* WFAVEngineKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2E56F6C820AAEB9F0063B4D6 /* WFAVEngineKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		6E616DB920AB3540002CB8BE /* WFChatClient.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2E56F6C920AAEB9F0063B4D6 /* WFChatClient.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+		9051774C2243CD830020A2AC /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9051774B2243CD830020A2AC /* SystemConfiguration.framework */; };
+		9051774E2243CD8D0020A2AC /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9051774D2243CD8D0020A2AC /* Security.framework */; };
+		905177502243CD9A0020A2AC /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9051774F2243CD9A0020A2AC /* libz.tbd */; };
+		905177522243CDA60020A2AC /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 905177512243CDA60020A2AC /* libc++.tbd */; };
+		905177542243CEA30020A2AC /* Bugly.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 905177532243CEA30020A2AC /* Bugly.framework */; };
 		9085427B2229FF160009713D /* StyleDIY.m in Sources */ = {isa = PBXBuildFile; fileRef = 908542792229FF160009713D /* StyleDIY.m */; };
 		9085427E222A00430009713D /* DIYScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9085427D222A00430009713D /* DIYScanViewController.m */; };
 		90854281222A04C80009713D /* QQLBXScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 90854280222A04C80009713D /* QQLBXScanViewController.m */; };
@@ -227,6 +232,11 @@
 		2FF07F5521F82E7200A78A62 /* WFCSecurityTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WFCSecurityTableViewController.m; sourceTree = "<group>"; };
 		6E616D9B20AB3435002CB8BE /* LICENSE.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = LICENSE.md; path = Frameworks/GoogleWebRTC/LICENSE.md; sourceTree = SOURCE_ROOT; };
 		6E616D9F20AB3435002CB8BE /* WebRTC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebRTC.framework; path = Frameworks/GoogleWebRTC/Frameworks/frameworks/WebRTC.framework; sourceTree = SOURCE_ROOT; };
+		9051774B2243CD830020A2AC /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
+		9051774D2243CD8D0020A2AC /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
+		9051774F2243CD9A0020A2AC /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
+		905177512243CDA60020A2AC /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
+		905177532243CEA30020A2AC /* Bugly.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Bugly.framework; path = WildFireChat/Bugly.framework; sourceTree = SOURCE_ROOT; };
 		908542792229FF160009713D /* StyleDIY.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StyleDIY.m; sourceTree = "<group>"; };
 		9085427A2229FF160009713D /* StyleDIY.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleDIY.h; sourceTree = "<group>"; };
 		9085427C222A00430009713D /* DIYScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DIYScanViewController.h; sourceTree = "<group>"; };
@@ -252,6 +262,11 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				905177522243CDA60020A2AC /* libc++.tbd in Frameworks */,
+				905177502243CD9A0020A2AC /* libz.tbd in Frameworks */,
+				905177542243CEA30020A2AC /* Bugly.framework in Frameworks */,
+				9051774E2243CD8D0020A2AC /* Security.framework in Frameworks */,
+				9051774C2243CD830020A2AC /* SystemConfiguration.framework in Frameworks */,
 				2F1B0DEE21E2161E00139CB1 /* CoreTelephony.framework in Frameworks */,
 				2F1B0DD521E1E29400139CB1 /* AudioToolbox.framework in Frameworks */,
 				2F1B0DCF21E19AF400139CB1 /* UserNotificationsUI.framework in Frameworks */,
@@ -324,12 +339,17 @@
 		2EAC88E61FB0A0D6004B34D1 /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				905177512243CDA60020A2AC /* libc++.tbd */,
+				9051774F2243CD9A0020A2AC /* libz.tbd */,
+				9051774D2243CD8D0020A2AC /* Security.framework */,
+				9051774B2243CD830020A2AC /* SystemConfiguration.framework */,
 				2F1B0DED21E2161E00139CB1 /* CoreTelephony.framework */,
 				2F1B0DD421E1E29400139CB1 /* AudioToolbox.framework */,
 				2F1B0DCD21E19AF400139CB1 /* NotificationCenter.framework */,
 				2F1B0DCE21E19AF400139CB1 /* UserNotifications.framework */,
 				2F1B0DCC21E19AF400139CB1 /* UserNotificationsUI.framework */,
 				2F143A80217F86B900B3E38A /* WFChatUIKit.xcassets */,
+				905177532243CEA30020A2AC /* Bugly.framework */,
 				2F143A6D217F7DA900B3E38A /* Emoj.plist */,
 				2F25F746219ECFD100FFABF9 /* WFCUShareMessageView.xib */,
 				2F143A6F217F7DA900B3E38A /* Stickers.bundle */,
@@ -909,6 +929,7 @@
 					"$(PROJECT_DIR)/Frameworks",
 					"$(PROJECT_DIR)/WildFireChat/AV/GoogleWebRTC/Frameworks/frameworks",
 					"$(PROJECT_DIR)/Frameworks/GoogleWebRTC/Frameworks/frameworks",
+					"$(PROJECT_DIR)/WildFireChat",
 				);
 				INFOPLIST_FILE = WildFireChat/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@@ -940,6 +961,7 @@
 					"$(PROJECT_DIR)/Frameworks",
 					"$(PROJECT_DIR)/WildFireChat/AV/GoogleWebRTC/Frameworks/frameworks",
 					"$(PROJECT_DIR)/Frameworks/GoogleWebRTC/Frameworks/frameworks",
+					"$(PROJECT_DIR)/WildFireChat",
 				);
 				INFOPLIST_FILE = WildFireChat/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;

+ 4 - 2
wfchat/WildFireChat/AppDelegate.m

@@ -30,19 +30,21 @@
 #import "QQLBXScanViewController.h"
 #import "StyleDIY.h"
 #import "GroupInfoViewController.h"
-
+#import <Bugly/Bugly.h>
 
 @interface AppDelegate () <ConnectionStatusDelegate, ReceiveMessageDelegate,
 #if WFCU_SUPPORT_VOIP
     WFAVEngineDelegate,
 #endif
-
     UNUserNotificationCenterDelegate, QrCodeDelegate>
 @property(nonatomic, strong) AVAudioPlayer *audioPlayer;
 @end
 
 @implementation AppDelegate
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+    //替换为您自己的Bugly账户。
+    [Bugly startWithAppId:@"b21375e023"];
+    
     [WFCCNetworkService startLog];
     [WFCCNetworkService sharedInstance].connectionStatusDelegate = self;
     [WFCCNetworkService sharedInstance].receiveMessageDelegate = self;

BIN
wfchat/WildFireChat/Bugly.framework/Bugly


+ 144 - 0
wfchat/WildFireChat/Bugly.framework/Headers/Bugly.h

@@ -0,0 +1,144 @@
+//
+//  Bugly.h
+//
+//  Version: 2.5(0)
+//
+//  Copyright (c) 2017年 Tencent. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import "BuglyConfig.h"
+#import "BuglyLog.h"
+
+BLY_START_NONNULL
+
+@interface Bugly : NSObject
+
+/**
+ *  初始化Bugly,使用默认BuglyConfig
+ *
+ *  @param appId 注册Bugly分配的应用唯一标识
+ */
++ (void)startWithAppId:(NSString * BLY_NULLABLE)appId;
+
+/**
+ *  使用指定配置初始化Bugly
+ *
+ *  @param appId 注册Bugly分配的应用唯一标识
+ *  @param config 传入配置的 BuglyConfig
+ */
++ (void)startWithAppId:(NSString * BLY_NULLABLE)appId
+                config:(BuglyConfig * BLY_NULLABLE)config;
+
+/**
+ *  使用指定配置初始化Bugly
+ *
+ *  @param appId 注册Bugly分配的应用唯一标识
+ *  @param development 是否开发设备
+ *  @param config 传入配置的 BuglyConfig
+ */
++ (void)startWithAppId:(NSString * BLY_NULLABLE)appId
+     developmentDevice:(BOOL)development
+                config:(BuglyConfig * BLY_NULLABLE)config;
+
+/**
+ *  设置用户标识
+ *
+ *  @param userId 用户标识
+ */
++ (void)setUserIdentifier:(NSString *)userId;
+
+/**
+ *  更新版本信息
+ *
+ *  @param version 应用版本信息
+ */
++ (void)updateAppVersion:(NSString *)version;
+
+/**
+ *  设置关键数据,随崩溃信息上报
+ *
+ *  @param value KEY
+ *  @param key VALUE
+ */
++ (void)setUserValue:(NSString *)value
+              forKey:(NSString *)key;
+
+/**
+ *  获取关键数据
+ *
+ *  @return 关键数据
+ */
++ (NSDictionary * BLY_NULLABLE)allUserValues;
+
+/**
+ *  设置标签
+ *
+ *  @param tag 标签ID,可在网站生成
+ */
++ (void)setTag:(NSUInteger)tag;
+
+/**
+ *  获取当前设置标签
+ *
+ *  @return 当前标签ID
+ */
++ (NSUInteger)currentTag;
+
+/**
+ *  获取设备ID
+ *
+ *  @return 设备ID
+ */
++ (NSString *)buglyDeviceId;
+
+/**
+ *  上报自定义Objective-C异常
+ *
+ *  @param exception 异常信息
+ */
++ (void)reportException:(NSException *)exception;
+
+/**
+ *  上报错误
+ *
+ *  @param error 错误信息
+ */
++ (void)reportError:(NSError *)error;
+
+/**
+ *    @brief 上报自定义错误
+ *
+ *    @param category    类型(Cocoa=3,CSharp=4,JS=5,Lua=6)
+ *    @param aName       名称
+ *    @param aReason     错误原因
+ *    @param aStackArray 堆栈
+ *    @param info        附加数据
+ *    @param terminate   上报后是否退出应用进程
+ */
++ (void)reportExceptionWithCategory:(NSUInteger)category
+                               name:(NSString *)aName
+                             reason:(NSString *)aReason
+                          callStack:(NSArray *)aStackArray
+                          extraInfo:(NSDictionary *)info
+                       terminateApp:(BOOL)terminate;
+
+/**
+ *  SDK 版本信息
+ *
+ *  @return SDK版本号
+ */
++ (NSString *)sdkVersion;
+
+/**
+ *  App 是否发生了连续闪退
+ *  如果 启动SDK 且 5秒内 闪退,且次数达到 3次 则判定为连续闪退
+ *
+ *  @return 是否连续闪退
+ */
++ (BOOL)isAppCrashedOnStartUpExceedTheLimit;
+
+BLY_END_NONNULL
+
+@end

+ 126 - 0
wfchat/WildFireChat/Bugly.framework/Headers/BuglyConfig.h

@@ -0,0 +1,126 @@
+//
+//  BuglyConfig.h
+//  Bugly
+//
+//  Copyright (c) 2016年 Tencent. All rights reserved.
+//
+
+#pragma once
+
+#define BLY_UNAVAILABLE(x) __attribute__((unavailable(x)))
+
+#if __has_feature(nullability)
+#define BLY_NONNULL __nonnull
+#define BLY_NULLABLE __nullable
+#define BLY_START_NONNULL _Pragma("clang assume_nonnull begin")
+#define BLY_END_NONNULL _Pragma("clang assume_nonnull end")
+#else
+#define BLY_NONNULL
+#define BLY_NULLABLE
+#define BLY_START_NONNULL
+#define BLY_END_NONNULL
+#endif
+
+#import <Foundation/Foundation.h>
+
+#import "BuglyLog.h"
+
+BLY_START_NONNULL
+
+@protocol BuglyDelegate <NSObject>
+
+@optional
+/**
+ *  发生异常时回调
+ *
+ *  @param exception 异常信息
+ *
+ *  @return 返回需上报记录,随异常上报一起上报
+ */
+- (NSString * BLY_NULLABLE)attachmentForException:(NSException * BLY_NULLABLE)exception;
+
+@end
+
+@interface BuglyConfig : NSObject
+
+/**
+ *  SDK Debug信息开关, 默认关闭
+ */
+@property (nonatomic, assign) BOOL debugMode;
+
+/**
+ *  设置自定义渠道标识
+ */
+@property (nonatomic, copy) NSString *channel;
+
+/**
+ *  设置自定义版本号
+ */
+@property (nonatomic, copy) NSString *version;
+
+/**
+ *  设置自定义设备唯一标识
+ */
+@property (nonatomic, copy) NSString *deviceIdentifier;
+
+/**
+ *  卡顿监控开关,默认关闭
+ */
+@property (nonatomic) BOOL blockMonitorEnable;
+
+/**
+ *  卡顿监控判断间隔,单位为秒
+ */
+@property (nonatomic) NSTimeInterval blockMonitorTimeout;
+
+/**
+ *  设置 App Groups Id (如有使用 Bugly iOS Extension SDK,请设置该值)
+ */
+@property (nonatomic, copy) NSString *applicationGroupIdentifier;
+
+/**
+ *  进程内还原开关,默认开启
+ */
+@property (nonatomic) BOOL symbolicateInProcessEnable;
+
+/**
+ *  非正常退出事件记录开关,默认关闭
+ */
+@property (nonatomic) BOOL unexpectedTerminatingDetectionEnable;
+
+/**
+ *  页面信息记录开关,默认开启
+ */
+@property (nonatomic) BOOL viewControllerTrackingEnable;
+
+/**
+ *  Bugly Delegate
+ */
+@property (nonatomic, assign) id<BuglyDelegate> delegate;
+
+/**
+ * 控制自定义日志上报,默认值为BuglyLogLevelSilent,即关闭日志记录功能。
+ * 如果设置为BuglyLogLevelWarn,则在崩溃时会上报Warn、Error接口打印的日志
+ */
+@property (nonatomic, assign) BuglyLogLevel reportLogLevel;
+
+/**
+ *  崩溃数据过滤器,如果崩溃堆栈的模块名包含过滤器中设置的关键字,则崩溃数据不会进行上报
+ *  例如,过滤崩溃堆栈中包含搜狗输入法的数据,可以添加过滤器关键字SogouInputIPhone.dylib等
+ */
+@property (nonatomic, copy) NSArray *excludeModuleFilter;
+
+/**
+ * 控制台日志上报开关,默认开启
+ */
+@property (nonatomic, assign) BOOL consolelogEnable;
+
+/**
+ * 崩溃退出超时,如果监听到崩溃后,App一直没有退出,则到达超时时间后会自动abort进程退出
+ * 默认值 5s, 单位 秒
+ * 当赋值为0时,则不会自动abort进程退出
+ */
+@property (nonatomic, assign) NSUInteger crashAbortTimeout;
+
+@end
+BLY_END_NONNULL

+ 78 - 0
wfchat/WildFireChat/Bugly.framework/Headers/BuglyLog.h

@@ -0,0 +1,78 @@
+//
+//  BuglyLog.h
+//  Bugly
+//
+//  Copyright (c) 2017年 Tencent. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+// Log level for Bugly Log
+typedef NS_ENUM(NSUInteger, BuglyLogLevel) {
+    BuglyLogLevelSilent  = 0,
+    BuglyLogLevelError   = 1,
+    BuglyLogLevelWarn    = 2,
+    BuglyLogLevelInfo    = 3,
+    BuglyLogLevelDebug   = 4,
+    BuglyLogLevelVerbose = 5,
+};
+#pragma mark -
+
+OBJC_EXTERN void BLYLog(BuglyLogLevel level, NSString *format, ...) NS_FORMAT_FUNCTION(2, 3);
+
+OBJC_EXTERN void BLYLogv(BuglyLogLevel level, NSString *format, va_list args) NS_FORMAT_FUNCTION(2, 0);
+
+#pragma mark -
+#define BUGLY_LOG_MACRO(_level, fmt, ...) [BuglyLog level:_level tag:nil log:fmt, ##__VA_ARGS__]
+
+#define BLYLogError(fmt, ...)   BUGLY_LOG_MACRO(BuglyLogLevelError, fmt, ##__VA_ARGS__)
+#define BLYLogWarn(fmt, ...)    BUGLY_LOG_MACRO(BuglyLogLevelWarn,  fmt, ##__VA_ARGS__)
+#define BLYLogInfo(fmt, ...)    BUGLY_LOG_MACRO(BuglyLogLevelInfo, fmt, ##__VA_ARGS__)
+#define BLYLogDebug(fmt, ...)   BUGLY_LOG_MACRO(BuglyLogLevelDebug, fmt, ##__VA_ARGS__)
+#define BLYLogVerbose(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelVerbose, fmt, ##__VA_ARGS__)
+
+#pragma mark - Interface
+@interface BuglyLog : NSObject
+
+/**
+ *    @brief  初始化日志模块
+ *
+ *    @param level 设置默认日志级别,默认BLYLogLevelSilent
+ *
+ *    @param printConsole 是否打印到控制台,默认NO
+ */
++ (void)initLogger:(BuglyLogLevel) level consolePrint:(BOOL)printConsole;
+
+/**
+ *    @brief 打印BLYLogLevelInfo日志
+ *
+ *    @param format   日志内容 总日志大小限制为:字符串长度30k,条数200
+ */
++ (void)log:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2);
+
+/**
+ *    @brief  打印日志
+ *
+ *    @param level 日志级别
+ *    @param message   日志内容 总日志大小限制为:字符串长度30k,条数200
+ */
++ (void)level:(BuglyLogLevel) level logs:(NSString *)message;
+
+/**
+ *    @brief  打印日志
+ *
+ *    @param level 日志级别
+ *    @param format   日志内容 总日志大小限制为:字符串长度30k,条数200
+ */
++ (void)level:(BuglyLogLevel) level log:(NSString *)format, ... NS_FORMAT_FUNCTION(2, 3);
+
+/**
+ *    @brief  打印日志
+ *
+ *    @param level  日志级别
+ *    @param tag    日志模块分类
+ *    @param format   日志内容 总日志大小限制为:字符串长度30k,条数200
+ */
++ (void)level:(BuglyLogLevel) level tag:(NSString *) tag log:(NSString *)format, ... NS_FORMAT_FUNCTION(3, 4);
+
+@end

+ 12 - 0
wfchat/WildFireChat/Bugly.framework/Modules/module.modulemap

@@ -0,0 +1,12 @@
+framework module Bugly {
+	umbrella header "Bugly.h"
+	
+	export *
+	module * { export * }
+	
+	link framework "Foundation"
+	link framework "Security"
+	link framework "SystemConfiguration"
+	link "c++"
+	link "z"
+}