3 Commits
1.0.0 ... 1.0.3

Author SHA1 Message Date
c6f37c94ba Fix package metadata GUID collisions 2026-06-12 16:51:19 +08:00
29477b5c12 Support iOS crash reporting 2026-06-12 16:42:45 +08:00
b803651b3f 更新版本 1.0.1 2024-04-03 16:01:22 +08:00
21 changed files with 290 additions and 101 deletions

View File

@@ -7,3 +7,21 @@
### 修复
* 优化package.json文件
# [1.0.2]
### 新增
* 支持 iOS 平台 Bugly SDK 桥接。
* iOS 导出 Xcode 工程时自动写入 `pod 'Bugly', '~> 2.6'` 依赖。
### 调整
* Unity 工程版本升级到 2022.3.62f3c1。
* package.json 的 Unity 兼容版本调整为 2022.3。
# [1.0.3]
### 修复
* 修复 `CHANGELOG.md.meta``package.json.meta` 和 Commercialization 包重复导致的 UPM GUID 冲突告警。

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: fca4353ab66a48e4ebe5032dc5057c7a
guid: cccafbb7533d45778a56bbd73c16b88f
TextScriptImporter:
externalObjects: {}
userData:

View File

@@ -1,14 +0,0 @@
{
"name": "CarshEditor",
"rootNamespace": "",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: eefc1e2f6ea9bd341bb892303ac533ff
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,65 @@
#if UNITY_IOS
using System;
using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;
namespace Editor
{
public static class CrashPostProcessBuildIOS
{
private const string PodLine = " pod 'Bugly', '~> 2.6'";
private const string UnityFrameworkTarget = "target 'UnityFramework' do";
[PostProcessBuild(980)]
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
{
if (target != BuildTarget.iOS)
{
return;
}
EnsureBuglyPod(pathToBuiltProject);
}
private static void EnsureBuglyPod(string pathToBuiltProject)
{
string podfilePath = Path.Combine(pathToBuiltProject, "Podfile");
string content = File.Exists(podfilePath) ? File.ReadAllText(podfilePath) : string.Empty;
if (content.Contains("pod 'Bugly'") || content.Contains("pod \"Bugly\""))
{
return;
}
if (string.IsNullOrWhiteSpace(content))
{
File.WriteAllText(podfilePath,
"platform :ios, '9.0'" + Environment.NewLine +
Environment.NewLine +
UnityFrameworkTarget + Environment.NewLine +
PodLine + Environment.NewLine +
"end" + Environment.NewLine);
}
else if (content.Contains(UnityFrameworkTarget))
{
content = content.Replace(UnityFrameworkTarget, UnityFrameworkTarget + Environment.NewLine + PodLine);
File.WriteAllText(podfilePath, content);
}
else
{
File.AppendAllText(podfilePath,
Environment.NewLine +
UnityFrameworkTarget + Environment.NewLine +
PodLine + Environment.NewLine +
"end" + Environment.NewLine);
}
Debug.Log("CrashReport iOS 已写入 Bugly CocoaPods 依赖,请在 Xcode 构建前执行 pod install。");
}
}
}
#endif

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 723804e1f52549b68c68e8c16f02ff90
timeCreated: 1781265600

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: fb7b442d8e32443e5856838741007f70
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,27 +0,0 @@
fileFormatVersion: 2
guid: 5b1ab29305b192b4a9e5b8d68cb54fd3
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0781c6de80d1d3c4daba0010f99c1ded
guid: ed4b4b94b0846a14987bc942de8b22bf
PluginImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 79531ba82725e4071861c982307805c3
folderAsset: yes
timeCreated: 1443426231
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,24 +0,0 @@
fileFormatVersion: 2
guid: 16eaf0ec67588418783d6f5311aa71ce
timeCreated: 1497948394
licenseType: Free
PluginImporter:
serializedVersion: 1
iconMap: {}
executionOrder: {}
isPreloaded: 0
platformData:
Android:
enabled: 1
settings:
CPU: x86
Any:
enabled: 0
settings: {}
Editor:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 594eacd11ce124d4eaafa7da7b0960e1
guid: eaf538d898ef490593642d0b031c7b85
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -0,0 +1,190 @@
#import <Foundation/Foundation.h>
#if __has_include(<Bugly/Bugly.h>)
#import <Bugly/Bugly.h>
#define FOLDCC_BUGLY_IOS_AVAILABLE 1
#else
#define FOLDCC_BUGLY_IOS_AVAILABLE 0
#endif
static NSString *FoldCCBuglyString(const char *value)
{
if (value == NULL)
{
return @"";
}
NSString *result = [NSString stringWithUTF8String:value];
return result == nil ? @"" : result;
}
static NSArray *FoldCCBuglyStackFrames(NSString *stackTrace)
{
if (stackTrace.length == 0)
{
return @[];
}
NSArray *lines = [stackTrace componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
NSMutableArray *frames = [NSMutableArray arrayWithCapacity:lines.count];
for (NSString *line in lines)
{
NSString *trimmed = [line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if (trimmed.length > 0)
{
[frames addObject:trimmed];
}
}
return frames;
}
static NSDictionary *FoldCCBuglyExtraInfo(NSString *extras)
{
if (extras.length == 0)
{
return @{};
}
NSData *data = [extras dataUsingEncoding:NSUTF8StringEncoding];
id parsed = data == nil ? nil : [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
if ([parsed isKindOfClass:[NSDictionary class]])
{
return parsed;
}
return @{ @"UnityExtraInfo" : extras };
}
#if FOLDCC_BUGLY_IOS_AVAILABLE
static NSString *s_channel = nil;
static NSString *s_version = nil;
static NSString *s_user = nil;
static NSString *s_deviceId = nil;
static BOOL s_debugMode = NO;
static BOOL s_initialized = NO;
static BuglyLogLevel FoldCCBuglyLogLevel(int level)
{
switch (level)
{
case 1:
return BuglyLogLevelError;
case 2:
return BuglyLogLevelWarn;
case 3:
return BuglyLogLevelInfo;
case 4:
return BuglyLogLevelDebug;
default:
return BuglyLogLevelSilent;
}
}
#endif
extern "C"
{
void _BuglyInit(const char *appId, bool debug, int level)
{
#if FOLDCC_BUGLY_IOS_AVAILABLE
if (s_initialized)
{
return;
}
BuglyConfig *config = [[BuglyConfig alloc] init];
config.debugMode = debug;
config.reportLogLevel = FoldCCBuglyLogLevel(level);
config.channel = s_channel;
config.version = s_version;
config.deviceIdentifier = s_deviceId;
config.consolelogEnable = debug;
[Bugly startWithAppId:FoldCCBuglyString(appId) config:config];
if (s_user.length > 0)
{
[Bugly setUserIdentifier:s_user];
}
s_debugMode = debug;
s_initialized = YES;
#endif
}
void _BuglySetUserId(const char *userId)
{
#if FOLDCC_BUGLY_IOS_AVAILABLE
NSString *value = FoldCCBuglyString(userId);
s_user = [value copy];
if (s_initialized && value.length > 0)
{
[Bugly setUserIdentifier:value];
}
#endif
}
void _BuglySetTag(int tag)
{
#if FOLDCC_BUGLY_IOS_AVAILABLE
if (s_initialized)
{
[Bugly setTag:(NSUInteger)tag];
}
#endif
}
void _BuglySetKeyValue(const char *key, const char *value)
{
#if FOLDCC_BUGLY_IOS_AVAILABLE
NSString *keyString = FoldCCBuglyString(key);
if (s_initialized && keyString.length > 0)
{
[Bugly setUserValue:FoldCCBuglyString(value) forKey:keyString];
}
#endif
}
void _BuglyReportException(int type, const char *name, const char *reason, const char *stackTrace, const char *extras, bool quit)
{
#if FOLDCC_BUGLY_IOS_AVAILABLE
if (s_initialized)
{
[Bugly reportExceptionWithCategory:(NSUInteger)type
name:FoldCCBuglyString(name)
reason:FoldCCBuglyString(reason)
callStack:FoldCCBuglyStackFrames(FoldCCBuglyString(stackTrace))
extraInfo:FoldCCBuglyExtraInfo(FoldCCBuglyString(extras))
terminateApp:quit];
}
#endif
}
void _BuglyDefaultConfig(const char *channel, const char *version, const char *user, const char *deviceId)
{
#if FOLDCC_BUGLY_IOS_AVAILABLE
s_channel = [FoldCCBuglyString(channel) copy];
s_version = [FoldCCBuglyString(version) copy];
s_user = [FoldCCBuglyString(user) copy];
s_deviceId = [FoldCCBuglyString(deviceId) copy];
#endif
}
void _BuglyLogMessage(int level, const char *tag, const char *log)
{
#if FOLDCC_BUGLY_IOS_AVAILABLE
if (s_initialized)
{
[BuglyLog level:FoldCCBuglyLogLevel(level) tag:FoldCCBuglyString(tag) log:@"%@", FoldCCBuglyString(log)];
}
#endif
}
void _BuglyConfigCrashReporterType(int type)
{
}
void _BuglySetExtraConfig(const char *key, const char *value)
{
_BuglySetKeyValue(key, value);
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 432060a129574479db0cfd441cdf3d69
guid: 50f7f5117f28421589a4ea87b6824291
PluginImporter:
externalObjects: {}
serializedVersion: 2
@@ -11,12 +11,6 @@ PluginImporter:
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings:
CPU: ARMv7
- first:
Any:
second:
@@ -28,6 +22,13 @@ PluginImporter:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -2,8 +2,8 @@
"name": "com.foldcc.cc-framework.crashreport",
"displayName": "CC-Framework.CrashReport",
"description": "Crash检测 异常上报",
"version": "1.0.0",
"unity": "2022.1",
"version": "1.0.3",
"unity": "2022.3",
"license": "MIT",
"repository": {
"type": "git",

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6bdc75239432ff3458a7b98e29519e6d
guid: 69559901a28448778705f9b6d1092264
TextScriptImporter:
externalObjects: {}
userData: