Mac認定のMac用Safari拡張機能(「GTMAppAuth」ポッド)を開発中です。しかし、私はSafariの拡張ターゲットに承認を処理することはできません。handleGetURLEvent:Safari拡張機能で呼び出されないMac OS
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent
私は
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>MyURL</string>
</array>
</dict>
</array>
をの.plistするURLを追加しました、それは拡張
にはAppDelegateませんので、私は、シングルトンにイベントハンドラを設定しています+ (Singleton *)sharedSingleton
{
static Singleton *singleton = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken,^
{
singleton = [[Singleton alloc] init];
NSAppleEventManager *appleEventManager =
[NSAppleEventManager sharedAppleEventManager];
[appleEventManager setEventHandler:self
andSelector:@selector(handleGetURLEvent:withReplyEvent:)
forEventClass:kInternetEventClass
andEventID:kAEGetURL];
});
return singleton;
}
処理のための私の方法:
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
NSString *URLString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
NSURL *URL = [NSURL URLWithString:URLString];
[_currentAuthorizationFlow resumeAuthorizationFlowWithURL:URL];
}
とにかく呼び出されていません。