Fixed an issue where the Airdrop screen could not be closed.

This commit is contained in:
straight-tamago
2024-01-28 16:06:59 +09:00
parent 491e53072f
commit 8c96736b94
2 changed files with 10 additions and 7 deletions

View File

@@ -18,7 +18,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.2</string> <string>1.3</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>LSSupportsOpeningDocumentsInPlace</key> <key>LSSupportsOpeningDocumentsInPlace</key>

View File

@@ -102,7 +102,6 @@ UIAlertController *doneController2 = NULL;
UIAlertAction *openAction = [UIAlertAction actionWithTitle:@"Share IPA with Airdrop" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { UIAlertAction *openAction = [UIAlertAction actionWithTitle:@"Share IPA with Airdrop" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
NSString *filePath = path; NSString *filePath = path;
NSDictionary* airdropDictionary;
NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/Sharing.framework"]; NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/Sharing.framework"];
[bundle load]; [bundle load];
@@ -115,12 +114,16 @@ UIAlertController *doneController2 = NULL;
NSURL *url = [NSURL fileURLWithPath:filePath]; NSURL *url = [NSURL fileURLWithPath:filePath];
id sharingView = [[objc_getClass("SFAirDropSharingViewControllerTV") alloc] initWithSharingItems:@[url]]; id sharingView = [[objc_getClass("SFAirDropSharingViewControllerTV") alloc] initWithSharingItems:@[url]];
// [sharingView setCompletionHandler:^(NSError *error) {
// NSString *sender = airdropDictionary[@"sender"];
// if (sender) {
// id defaultWorkspace = [objc_getClass("LSApplicationWorkspace") defaultWorkspace];
// [defaultWorkspace performSelector:@selector(openApplicationWithBundleID:) withObject:(id)sender];
// }
// }];
[sharingView setCompletionHandler:^(NSError *error) { [sharingView setCompletionHandler:^(NSError *error) {
NSString *sender = airdropDictionary[@"sender"]; NSLog(@"complete with error: %@", error);
if (sender) { [self dismissViewControllerAnimated:true completion:nil];
id defaultWorkspace = [objc_getClass("LSApplicationWorkspace") defaultWorkspace];
[defaultWorkspace performSelector:@selector(openApplicationWithBundleID:) withObject:(id)sender];
}
}]; }];
[self presentViewController:sharingView animated:true completion:nil]; [self presentViewController:sharingView animated:true completion:nil];