过去几个小时我一直在SNRLastFMEngine上工作,使它对iOS友好,但已经陷入瘫痪。我的问题是在一个单一的功能,似乎使用功能只适用于Mac OS的可可应用程序。将可可翻译成可可 -
功能是如下:
- (void)_registerCustomURLSchemeHandler
{
// Register for Apple Events
NSAppleEventManager *em = [NSAppleEventManager sharedAppleEventManager];
[em setEventHandler:self andSelector:@selector(getURL:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
// Set Sonora as the default handler
NSString *bundleID = [[NSBundle mainBundle] bundleIdentifier];
LSSetDefaultHandlerForURLScheme((CFStringRef)kCustomURLScheme, (CFStringRef)bundleID);
}
其中kCustomURLScheme
是预先定义NSString
,然后由一个函数处理:- (void)getURL:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
我考虑添加NSNotification
观察者来处理事件,但没有任何运气(它不承认事件类别或事件ID,并且我不知道该如何处理LSSetDefaultHandlerForURLScheme
)。我对Mac OS应用程序没有任何经验,我相信我错过了更大的图景。我非常感谢有这两种语言知识的人的帮助/指导。