fix: 修复bug

This commit is contained in:
barry
2026-07-09 16:37:31 +08:00
parent 7003140acc
commit f2586d11a6
19 changed files with 19013 additions and 19002 deletions
+42 -40
View File
@@ -1,4 +1,4 @@
//#import <Photos/Photos.h>
#import <Photos/Photos.h>
extern "C" {
#import "UnityAppController.h"
#import "iOSBridgePlugin.h"
@@ -11,50 +11,50 @@ extern "C" {
// 保存视频到相册并设置自定义创建日期
void SaveVideoWithCustomDate(const char* videoPathCStr)
{
// @autoreleasepool {
// NSString *videoPath = [NSString stringWithUTF8String:videoPathCStr];
// NSURL *videoURL = [NSURL fileURLWithPath:videoPath];
//
// // 使用当前时间作为创建时间
// NSDate *currentDate = [NSDate date];
//
// [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
// PHAssetChangeRequest *request = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:videoURL];
// request.creationDate = currentDate;
// } completionHandler:^(BOOL success, NSError * _Nullable error) {
// if (success) {
// UnitySendMessage("UnityManager", "Showtips","save_successed");
// UnitySendMessage("UnityManager", "CloseDownloadUI", "");
// } else {
// //NSLog(@"❌ 保存失败:%@", error);
// }
// }];
// }
@autoreleasepool {
NSString *videoPath = [NSString stringWithUTF8String:videoPathCStr];
NSURL *videoURL = [NSURL fileURLWithPath:videoPath];
// 使用当前时间作为创建时间
NSDate *currentDate = [NSDate date];
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetChangeRequest *request = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:videoURL];
request.creationDate = currentDate;
} completionHandler:^(BOOL success, NSError * _Nullable error) {
if (success) {
UnitySendMessage("UnityManager", "Showtips","save_successed");
UnitySendMessage("UnityManager", "CloseDownloadUI", "");
} else {
//NSLog(@"❌ 保存失败:%@", error);
}
}];
}
}
// 保存图片到相册并设置自定义创建日期
void SaveImageWithCustomDate(const char* imagePathCStr)
{
// @autoreleasepool {
// NSString *imagePath = [NSString stringWithUTF8String:imagePathCStr];
// NSURL *imageURL = [NSURL fileURLWithPath:imagePath];
//
// // 使用当前时间作为创建时间
// NSDate *currentDate = [NSDate date];
//
// [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
// PHAssetChangeRequest *request = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:imageURL];
// request.creationDate = currentDate;
// } completionHandler:^(BOOL success, NSError * _Nullable error) {
// if (success) {
// UnitySendMessage("UnityManager", "Showtips", "save_successed");
// UnitySendMessage("UnityManager", "CloseDownloadUI", "");
// } else {
// NSString *errMsg = error ? [error localizedDescription] : @"Unknown error";
// UnitySendMessage("UnityManager", "Showtips", [errMsg UTF8String]);
// }
// }];
// }
@autoreleasepool {
NSString *imagePath = [NSString stringWithUTF8String:imagePathCStr];
NSURL *imageURL = [NSURL fileURLWithPath:imagePath];
// 使用当前时间作为创建时间
NSDate *currentDate = [NSDate date];
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetChangeRequest *request = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:imageURL];
request.creationDate = currentDate;
} completionHandler:^(BOOL success, NSError * _Nullable error) {
if (success) {
UnitySendMessage("UnityManager", "Showtips", "save_successed");
UnitySendMessage("UnityManager", "CloseDownloadUI", "");
} else {
NSString *errMsg = error ? [error localizedDescription] : @"Unknown error";
UnitySendMessage("UnityManager", "Showtips", [errMsg UTF8String]);
}
}];
}
}
void TrackProduct(const char *eventName, const char *dictionaryJson)
{
@@ -137,3 +137,5 @@ void SetBtn(int left, int top, int right, int bottom){
}
}