Commit 03d01b4b authored by rockypzhang's avatar rockypzhang

add debug mode switch for ios sdk

parent 2ee82783
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"bugly_crash","path":"/Users/zhhp1121/zhp/project/as/flutter/Bugly-Flutter-Plugin/","dependencies":[]}],"android":[{"name":"bugly_crash","path":"/Users/zhhp1121/zhp/project/as/flutter/Bugly-Flutter-Plugin/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"bugly_crash","dependencies":[]}],"date_created":"2021-05-28 19:16:04.625405","version":"2.2.1"} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"bugly_crash","path":"/Users/zhhp1121/zhp/project/as/flutter/Bugly-Flutter-Plugin/","dependencies":[]}],"android":[{"name":"bugly_crash","path":"/Users/zhhp1121/zhp/project/as/flutter/Bugly-Flutter-Plugin/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"bugly_crash","dependencies":[]}],"date_created":"2021-06-07 20:14:48.940051","version":"2.2.1"}
\ No newline at end of file \ No newline at end of file
...@@ -3,12 +3,13 @@ ...@@ -3,12 +3,13 @@
export "FLUTTER_ROOT=/Users/zhhp1121/zhp/flutter/flutter" export "FLUTTER_ROOT=/Users/zhhp1121/zhp/flutter/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/zhhp1121/zhp/project/as/flutter/Bugly-Flutter-Plugin/example" export "FLUTTER_APPLICATION_PATH=/Users/zhhp1121/zhp/project/as/flutter/Bugly-Flutter-Plugin/example"
export "COCOAPODS_PARALLEL_CODE_SIGN=true" export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_TARGET=/Users/zhhp1121/zhp/project/as/flutter/Bugly-Flutter-Plugin/example/lib/main.dart"
export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios" export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1" export "FLUTTER_BUILD_NUMBER=1"
export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export "DART_OBFUSCATION=false" export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=false" export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false" export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.packages" export "PACKAGE_CONFIG=/Users/zhhp1121/zhp/project/as/flutter/Bugly-Flutter-Plugin/example/.dart_tool/package_config.json"
...@@ -65,7 +65,8 @@ class _MyAppState extends State<MyApp> { ...@@ -65,7 +65,8 @@ class _MyAppState extends State<MyApp> {
} }
void initBuglyIos(){ void initBuglyIos(){
Bugly.initIosCrashReport(appId:"87654c7bfa"); //Bugly.initIosCrashReport(appId:"87654c7bfa",debugMode: true,serverUrl: "https://ios.bugly.qcloud.com/rqd/sync");
Bugly.initIosCrashReport(appId:"87654c7bfa",debugMode: true);
Bugly.setUserSceneTag(userSceneTag: 116852); Bugly.setUserSceneTag(userSceneTag: 116852);
Bugly.setAppVersion(appVersion:"1.9.2"); Bugly.setAppVersion(appVersion:"1.9.2");
Bugly.putUserData(userKey:"userkey1",userValue:"uservalue1"); Bugly.putUserData(userKey:"userkey1",userValue:"uservalue1");
......
...@@ -15,11 +15,20 @@ ...@@ -15,11 +15,20 @@
result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]); result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
} else if ([@"initCrashReport" isEqualToString:call.method]) { } else if ([@"initCrashReport" isEqualToString:call.method]) {
NSString *appId = call.arguments[@"appId"]; NSString *appId = call.arguments[@"appId"];
NSNumber *debugModeNumber = call.arguments[@"debugMode"];
NSUInteger *debugModeInt = [debugModeNumber integerValue];
NSString *serverUrl = call.arguments[@"serverUrl"];
BuglyConfig *config = [[BuglyConfig alloc] init]; BuglyConfig *config = [[BuglyConfig alloc] init];
config.debugMode = YES; if(debugModeInt > 0) {
config.debugMode = YES;
} else {
config.debugMode = NO;
}
if(![self isEmpty:serverUrl]) {
config.crashServerUrl = serverUrl;
}
config.reportLogLevel = BuglyLogLevelVerbose; config.reportLogLevel = BuglyLogLevelVerbose;
NSLog(@"initCrashReport appid:%@",appId); NSLog(@"initCrashReport appid:%@ debugmode is %d serverUrl is %@",appId,debugModeInt,serverUrl);
//[Bugly startWithAppId:appId];
[Bugly startWithAppId:appId config:config]; [Bugly startWithAppId:appId config:config];
} else if ([@"postException" isEqualToString:call.method]) { } else if ([@"postException" isEqualToString:call.method]) {
NSLog(@"postException"); NSLog(@"postException");
...@@ -73,4 +82,15 @@ ...@@ -73,4 +82,15 @@
} }
} }
- (BOOL)isEmpty:(id)object{
if (object == nil || [object isEqual:[NSNull null]]) {
return YES;
} else if ([object isKindOfClass:[NSString class]]) {
return [object isEqualToString:@""];
} else if ([object isKindOfClass:[NSNumber class]]) {
return [object isEqualToNumber:@(0)];
}
return NO;
}
@end @end
...@@ -101,9 +101,13 @@ class Bugly { ...@@ -101,9 +101,13 @@ class Bugly {
*/ */
static Future<void> initIosCrashReport({ static Future<void> initIosCrashReport({
String? appId, String? appId,
bool? debugMode,
String? serverUrl,
}) async{ }) async{
Map<String, Object?> map = { Map<String, Object?> map = {
"appId": appId, "appId": appId,
"debugMode": debugMode,
"serverUrl": serverUrl
}; };
_channel.invokeMethod("initCrashReport",map); _channel.invokeMethod("initCrashReport",map);
} }
......
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