Commit 002db533 authored by fengchao's avatar fengchao
Browse files

fix(code):修改iOS分享

parent eaa6b224
......@@ -266,14 +266,21 @@ extern "C" {
[sdk pay:payInfo];
}
void _StartShare(int shareType, const char* title, const char* imagePath, const char* url) {
void _StartShare(int shareType, const char* jsonInfo) {
NSLog(@"🍎 调用SDK分享");
AccessCoreSdk *sdk = [AccessCoreSdk shareAccessCoreSdkManage];
NSString *jsonStr = [NSString stringWithUTF8String:jsonInfo];
NSData *jsonData = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
NSError *error = nil;
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
if (error) return;
AccessShareInfo *shareInfo = [[AccessShareInfo alloc] init];
shareInfo.title = [NSString stringWithUTF8String:title];
shareInfo.imagePath = [NSString stringWithUTF8String:imagePath];
shareInfo.linkPath = [NSString stringWithUTF8String:url];
shareInfo.title = [NSString stringWithFormat:@"%@", jsonDict[@"title"]];
shareInfo.imagePath = [NSString stringWithFormat:@"%@", jsonDict[@"picPath"]];
shareInfo.linkPath = [NSString stringWithFormat:@"%@", jsonDict[@"shareUrl"]];
[sdk shareType:(THREE_SHARE_TYPE)shareType shareObject:shareInfo];
}
......
......@@ -15,7 +15,7 @@ public class IosSdkInterface
[DllImport("__Internal")] private static extern void _StartPay(string jsonInfo);
// 分享功能
[DllImport("__Internal")] private static extern void _StartShare(int shareType, string title, string content, string url);
[DllImport("__Internal")] private static extern void _StartShare(int shareType, string jsonInfo);
// 数据上报
[DllImport("__Internal")] private static extern void _ReportUserInfoFull(int eventType, string jsonInfo);
......@@ -50,9 +50,9 @@ public class IosSdkInterface
_StartPay(json);
}
public static void StartShare(int shareType, string title, string imagePath, string url)
public static void StartShare(int shareType, string jsonstr)
{
_StartShare(shareType, title, imagePath, url);
_StartShare(shareType, jsonstr);
}
public static void ReportUserInfoFull(EventType eventType, string jsonStr)
......
......@@ -111,7 +111,7 @@ public static class HoolaiSdkManager
#elif UNITY_IOS && !UNITY_EDITOR
// iOS 分享参数解析(可根据需要扩展)
Debug.Log("【UnifiedSdkManager】iOS 分享暂未实现完整解析");
IosSdkInterface.StartShare(shareType, "Title", "Content", "https://example.com");
IosSdkInterface.StartShare(type, jsonStr);
#else
Debug.Log($"【UnifiedSdkManager】模拟调用:分享,平台={shareType}");
#endif
......
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