From 7ed84fd445bdd2aed987fd8834a480da4a8b35bf Mon Sep 17 00:00:00 2001 From: CodeST <694468528@qq.com> Date: Tue, 30 Dec 2025 20:41:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E4=BA=AB=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- keyBoard/Class/Me/VC/MyVC.m | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/keyBoard/Class/Me/VC/MyVC.m b/keyBoard/Class/Me/VC/MyVC.m index 02c4519..baa45dd 100644 --- a/keyBoard/Class/Me/VC/MyVC.m +++ b/keyBoard/Class/Me/VC/MyVC.m @@ -128,9 +128,12 @@ if (!self.viewModel) { self.viewModel = [[KBMyVM alloc] init]; } + __weak typeof(self) weakSelf = self; [KBHUD show]; [self.viewModel fetchInviteCodeWithCompletion:^(KBInviteCodeModel * _Nullable inviteCode, NSError * _Nullable error) { dispatch_async(dispatch_get_main_queue(), ^{ + __strong typeof(weakSelf) self = weakSelf; + if (!self) { return; } [KBHUD dismiss]; if (error) { [KBHUD showInfo:error.localizedDescription ?: KBLocalized(@"Network error")]; @@ -142,9 +145,21 @@ [KBHUD showInfo:KBLocalized(@"Failed")]; return; } - + + id shareItem = textToCopy; + NSURL *url = [NSURL URLWithString:textToCopy]; + if (url) { + shareItem = url; + } + UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[shareItem] applicationActivities:nil]; + UIPopoverPresentationController *popover = activityVC.popoverPresentationController; + if (popover) { + popover.sourceView = self.view; + popover.sourceRect = CGRectMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds), 1, 1); + popover.permittedArrowDirections = 0; + } UIPasteboard.generalPasteboard.string = textToCopy; - [KBHUD showInfo:KBLocalized(@"Copy Success")]; + [self presentViewController:activityVC animated:YES completion:nil]; }); }];