Commit c1e2bc68 authored by rockypzhang's avatar rockypzhang

增加ios crash上报功能

parent 70d97ec8
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
</code_scheme>
</component>
\ No newline at end of file
......@@ -2,6 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Bugly-Flutter-Plugin.iml" filepath="$PROJECT_DIR$/.idea/Bugly-Flutter-Plugin.iml" />
<module fileurl="file://$PROJECT_DIR$/bugly_crash.iml" filepath="$PROJECT_DIR$/bugly_crash.iml" />
</modules>
</component>
......
......@@ -2,5 +2,6 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/example/ios/.symlinks/plugins/bugly_crash" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -92,6 +92,14 @@ public class BuglyCrashPlugin implements MethodCallHandler {
}
CrashReport.setUserSceneTag(mContext,userSceneTag);
BuglyCrashPluginLog.d("mContext:"+mContext+" appVersion:"+userSceneTag);
}else if (call.method.equals("setUserId")){
int userSceneTag = 0;
String userId = "";
if (call.hasArgument("userId")) {
userId = call.argument("userId");
}
CrashReport.setUserId(mContext,userId);
BuglyCrashPluginLog.d("mContext:"+mContext+" appVersion:"+userSceneTag);
}else if (call.method.equals("putUserData")){
String userKey = "";
String userValue = "";
......
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end
target 'Runner' do
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
}
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
pod 'Bugly'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
PODS:
- Bugly (2.5.0)
- bugly_crash (0.0.1):
- Bugly
- Flutter
- Flutter (1.0.0)
DEPENDENCIES:
- Bugly
- bugly_crash (from `.symlinks/plugins/bugly_crash/ios`)
- Flutter (from `.symlinks/flutter/ios`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- Bugly
EXTERNAL SOURCES:
bugly_crash:
:path: ".symlinks/plugins/bugly_crash/ios"
Flutter:
:path: ".symlinks/flutter/ios"
SPEC CHECKSUMS:
Bugly: 3ca9f255c01025582df26f9222893b383c7e4b4e
bugly_crash: b528f0f01b0034fec1973568e8ed39e640d734f3
Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a
PODFILE CHECKSUM: 9e01bf1cd72782c72804195fc2404be54f11b302
COCOAPODS: 1.7.1
......@@ -11,6 +11,7 @@
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
6E7A17792257DAC337A5F73E /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D101F8DF40C534265D7CCDEC /* libPods-Runner.a */; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
......@@ -44,6 +45,7 @@
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
7C3C05A7A83AF68D97DE093B /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
......@@ -53,6 +55,9 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B365B6FC69774BFA612462FF /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
D101F8DF40C534265D7CCDEC /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
F6D3863BE5DFD15715074DA3 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -62,12 +67,24 @@
files = (
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
6E7A17792257DAC337A5F73E /* libPods-Runner.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
85ABD7B23C5CFA56FE40B932 /* Pods */ = {
isa = PBXGroup;
children = (
F6D3863BE5DFD15715074DA3 /* Pods-Runner.debug.xcconfig */,
7C3C05A7A83AF68D97DE093B /* Pods-Runner.release.xcconfig */,
B365B6FC69774BFA612462FF /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
......@@ -87,7 +104,8 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
85ABD7B23C5CFA56FE40B932 /* Pods */,
DBD106C7C39A1F2E9F678178 /* Frameworks */,
);
sourceTree = "<group>";
};
......@@ -123,6 +141,14 @@
name = "Supporting Files";
sourceTree = "<group>";
};
DBD106C7C39A1F2E9F678178 /* Frameworks */ = {
isa = PBXGroup;
children = (
D101F8DF40C534265D7CCDEC /* libPods-Runner.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
......@@ -130,12 +156,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
4723676552AEEAE9DFE1A437 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
A0E05FA2A55187C9C90BEFBC /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
......@@ -208,6 +236,28 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
};
4723676552AEEAE9DFE1A437 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......@@ -222,6 +272,24 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
A0E05FA2A55187C9C90BEFBC /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
......
......@@ -4,4 +4,7 @@
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
</dict>
</plist>
......@@ -4,7 +4,7 @@ import 'dart:async';
import 'package:flutter/services.dart';
import 'package:bugly_crash/bugly.dart';
import 'package:bugly_crash/buglyLog.dart';
import 'dart:io';
//void main() => runApp(MyApp());
Map<String,String> extraInfo = {"key1":"value1","key2":"value2","key3":"value1"};
......@@ -35,20 +35,43 @@ class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
initPlatformState();
if(Platform.isAndroid){
initBuglyAndroid();
}else if(Platform.isIOS){
initBuglyIos();
}
}
void initBuglyAndroid(){
Bugly.initAndroidCrashReport(appId:"d562178d23",isDebug: true);
Bugly.setUserId(userId:"androiduser");
Bugly.setUserSceneTag(userSceneTag: 111437);
Bugly.setIsDevelopmentDevice(isDevelopmentDevice: true);
Bugly.setAppVersion(appVersion:"1.9.3");
//bugly自定义日志,可在"跟踪日志"页面查看
BuglyLog.d(tag:"bugly",content:"debugvalue");
BuglyLog.i(tag:"bugly",content:"infovalue");
BuglyLog.v(tag:"bugly",content:"verbosevalue");
BuglyLog.w(tag:"bugly",content:"warnvalue");
BuglyLog.e(tag:"bugly",content:"errorvalue");
//自定义map参数 可在"跟踪数据"页面查看
Bugly.putUserData(userKey:"userkey1",userValue:"uservalue1");
Bugly.putUserData(userKey:"userkey2",userValue:"uservalue2");
}
void initBuglyIos(){
Bugly.initIosCrashReport(appId:"87654c7bfa");
Bugly.setUserSceneTag(userSceneTag: 116852);
Bugly.setAppVersion(appVersion:"1.9.2");
Bugly.setAppChannel(appChannel: "flutter_test");
Bugly.setAppPackage(appPackage: "com.bugly.flutter.test");
Bugly.setUserSceneTag(userSceneTag: 30);
Bugly.putUserData(userKey:"userkey1",userValue:"uservalue1");
Bugly.putUserData(userKey:"userkey2",userValue:"uservalue2");
BuglyLog.d(tag:"d",content:"value");
BuglyLog.i(tag:"i",content:"value");
BuglyLog.v(tag:"v",content:"value");
BuglyLog.w(tag:"w",content:"value");
BuglyLog.e(tag:"e",content:"value");
Bugly.setIsDevelopmentDevice(isDevelopmentDevice: true);
Bugly.initCrashReport(appId:"d562178d23",isDebug: true);
initPlatformState();
Bugly.setUserId(userId:"iosuser");
BuglyLog.d(tag:"bugly",content:"debugvalue");
BuglyLog.i(tag:"bugly",content:"infovalue");
BuglyLog.w(tag:"bugly",content:"warnvalue");
BuglyLog.v(tag:"bugly",content:"verbosevalue");
BuglyLog.e(tag:"bugly",content:"errorvalue");
}
// Platform messages are asynchronous, so we initialize in an async method.
......@@ -71,7 +94,7 @@ class _MyAppState extends State<MyApp> {
}
//测试APP未捕获到的异常上报
throw 'bugly flutter uncaught error test';
//throw 'bugly flutter uncaught error test';
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
......@@ -83,6 +106,10 @@ class _MyAppState extends State<MyApp> {
});
}
_onClick(){
throw 'bugly flutter uncaught error test';
}
@override
Widget build(BuildContext context) {
return MaterialApp(
......@@ -91,7 +118,10 @@ class _MyAppState extends State<MyApp> {
title: const Text('Plugin example app'),
),
body: Center(
child: GestureDetector(
onTap: _onClick,
child: Text('Running on: $_platformVersion\n'),
)
),
),
);
......
......@@ -5,14 +5,14 @@ packages:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "2.0.8"
version: "2.1.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.0.4"
bugly_crash:
......@@ -26,21 +26,21 @@ packages:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.14.11"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "0.1.2"
flutter:
......@@ -57,37 +57,37 @@ packages:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "0.12.3+1"
version: "0.12.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.1.6"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.4.0"
version: "1.5.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "2.0.1"
version: "2.0.2"
sky_engine:
dependency: transitive
description: flutter
......@@ -97,57 +97,57 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.5.4"
version: "1.5.5"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.6.8"
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.0.4"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "0.2.2"
version: "0.2.4"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.1.6"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "2.0.8"
sdks:
dart: ">=2.1.0 <3.0.0"
dart: ">=2.2.0 <3.0.0"
#import "BuglyCrashPlugin.h"
#import <Bugly/Bugly.h>
#import <Bugly/BuglyLog.h>
@implementation BuglyCrashPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
FlutterMethodChannel* channel = [FlutterMethodChannel
methodChannelWithName:@"bugly_crash"
methodChannelWithName:@"bugly"
binaryMessenger:[registrar messenger]];
BuglyCrashPlugin* instance = [[BuglyCrashPlugin alloc] init];
[registrar addMethodCallDelegate:instance channel:channel];
......@@ -12,6 +14,61 @@
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if ([@"getPlatformVersion" isEqualToString:call.method]) {
result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
} else if ([@"initCrashReport" isEqualToString:call.method]) {
NSString *appId = call.arguments[@"appId"];
BuglyConfig *config = [[BuglyConfig alloc] init];
config.debugMode = YES;
config.reportLogLevel = BuglyLogLevelVerbose;
NSLog(@"initCrashReport appid:%@",appId);
//[Bugly startWithAppId:appId];
[Bugly startWithAppId:appId config:config];
} else if ([@"postException" isEqualToString:call.method]) {
NSLog(@"postException");
NSString *type = call.arguments[@"type"];
NSString *error = call.arguments[@"error"];
NSString *stackTrace = call.arguments[@"stackTrace"];
NSDictionary *extraInfo = call.arguments[@"extraInfo"];
NSLog(@"type: %@ , error: %@ , stacktrace: %@",type,error,stackTrace);
NSArray *stackTraceArray = [stackTrace componentsSeparatedByString:@""];
[Bugly reportExceptionWithCategory:5 name:error reason:@" " callStack:stackTraceArray extraInfo:extraInfo terminateApp:NO];
} else if ([@"setAppVersion" isEqualToString:call.method]){
NSString *appVersion = call.arguments[@"appVersion"];
NSLog(@"setAppVersion %@",appVersion);
[Bugly updateAppVersion:appVersion];
} else if ([@"setUserId" isEqualToString:call.method]){
NSString *userId = call.arguments[@"userId"];
NSLog(@"setUserId %@",userId);
[Bugly setUserIdentifier:userId];
} else if ([@"putUserData" isEqualToString:call.method]){
NSString *userKey = call.arguments[@"userKey"];
NSString *userValue = call.arguments[@"userValue"];
NSLog(@"putUserData userKey %@ userValue %@ ",userKey,userValue);
[Bugly setUserValue:userValue forKey:userKey];
} else if([@"setUserSceneTag" isEqualToString:call.method]) {
NSNumber *tagNumber = call.arguments[@"userSceneTag"];
NSUInteger *tagInt = [tagNumber integerValue];
[Bugly setTag:tagInt];
NSLog(@"setUserSceneTag");
} else if ([@"logd" isEqualToString:call.method]){
NSString *tag = call.arguments[@"tag"];
NSString *log = call.arguments[@"content"];
[BuglyLog level:BuglyLogLevelDebug tag:tag log:log];
} else if ([@"logi" isEqualToString:call.method]){
NSString *tag = call.arguments[@"tag"];
NSString *log = call.arguments[@"content"];
[BuglyLog level:BuglyLogLevelInfo tag:tag log:log];
} else if ([@"logv" isEqualToString:call.method]){
NSString *tag = call.arguments[@"tag"];
NSString *log = call.arguments[@"content"];
[BuglyLog level:BuglyLogLevelVerbose tag:tag log:log];
} else if ([@"logw" isEqualToString:call.method]){
NSString *tag = call.arguments[@"tag"];
NSString *log = call.arguments[@"content"];
[BuglyLog level:BuglyLogLevelWarn tag:tag log:log];
} else if ([@"loge" isEqualToString:call.method]){
NSString *tag = call.arguments[@"tag"];
NSString *log = call.arguments[@"content"];
[BuglyLog level:BuglyLogLevelError tag:tag log:log];
} else {
result(FlutterMethodNotImplemented);
}
......
......@@ -15,6 +15,7 @@ bugly crash plugin
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'Bugly'
s.ios.deployment_target = '8.0'
end
......
import 'dart:async';
import 'dart:io';
import 'package:flutter/services.dart';
/**
......@@ -20,17 +21,30 @@ class Bugly {
* @param appId appId
* @param isDebug 是否打开debug开关
*/
static Future<void> initCrashReport({
static Future<void> initAndroidCrashReport({
String appId,
bool isDebug,
}) async{
Map<String, Object> map = {
"appId":appId,
"appId": appId,
"isDebug":isDebug,
};
_channel.invokeMethod("initCrashReport",map);
}
/**
* 初始化接口.
* @param appId appId
*/
static Future<void> initIosCrashReport({
String appId,
}) async{
Map<String, Object> map = {
"appId": appId,
};
_channel.invokeMethod("initCrashReport",map);
}
/**
* 上报自定义异常.
*
......@@ -62,11 +76,13 @@ class Bugly {
static Future<void> setAppChannel({
String appChannel,
}) async{
if(Platform.isAndroid){
Map<String, Object> map = {
"appChannel":appChannel,
};
_channel.invokeMethod("setAppChannel",map);
}
}
/**
* 设置App包名
......@@ -76,11 +92,13 @@ class Bugly {
static Future<void> setAppPackage({
String appPackage,
}) async{
if(Platform.isAndroid){
Map<String, Object> map = {
"appPackage":appPackage,
};
_channel.invokeMethod("setAppPackage",map);
}
}
/**
* 设置App版本
......@@ -110,6 +128,20 @@ class Bugly {
_channel.invokeMethod("setUserSceneTag",map);
}
/**
* 设置用户id
*
* @param userSceneTag 唯一标识一种场景,必须大于0
*/
static Future<void> setUserId({
String userId,
}) async{
Map<String, Object> map = {
"userId":userId,
};
_channel.invokeMethod("setUserId",map);
}
/**
* 添加用户数据Key,Value.
*
......@@ -134,10 +166,12 @@ class Bugly {
static Future<void> setIsDevelopmentDevice({
bool isDevelopmentDevice,
}) async{
if(Platform.isAndroid){
Map<String, Object> map = {
"isDevelopmentDevice":isDevelopmentDevice,
};
_channel.invokeMethod("setIsDevelopmentDevice",map);
}
}
}
import 'dart:async';
import 'package:flutter/services.dart';
class BuglyLog {
static const MethodChannel _channel =
const MethodChannel('bugly');
......
......@@ -5,28 +5,28 @@ packages:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "2.0.8"
version: "2.1.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.0.4"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.14.11"
flutter:
......@@ -43,37 +43,37 @@ packages:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "0.12.3+1"
version: "0.12.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.1.6"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.4.0"
version: "1.5.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "2.0.1"
version: "2.0.2"
sky_engine:
dependency: transitive
description: flutter
......@@ -83,57 +83,57 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.5.4"
version: "1.5.5"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.6.8"
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.0.4"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "0.2.2"
version: "0.2.4"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "1.1.6"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
url: "https://dart-pub.mirrors.sjtug.sjtu.edu.cn/"
source: hosted
version: "2.0.8"
sdks:
dart: ">=2.1.0 <3.0.0"
dart: ">=2.2.0 <3.0.0"
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