I am trying to open the keyboard app on iOS using the following method:
- (void)actionForGotoHostAppWithURL:(NSURL *)url {
UIResponder *responder = self;
do {
if ([responder respondsToSelector:@selector(openURL:options:completionHandler:)] && [responder isKindOfClass:[UIApplication class]]) {
[responder performSelector:@selector(openURL:options:completionHandler:) withObject:url withObject:nil];
break;
}
} while ((responder = [responder nextResponder]) != nil);
}
While this works with older iOS versions, I am getting the following error with iOS 26:
Error Domain=NSOSStatusErrorDomain Code=-54 "(null)" UserInfo={_LSFile=LSOpenOperation.mm, _LSLine=835, _LSFunction=_LSIsRequestAllowed}
What is the new method for doing that?
HangarRash
16.8k5 gold badges31 silver badges64 bronze badges
lang-objectivec
performSelection:withObject:withObject:only works with methods that take 2 arguments. You are trying to use it with a selector that takes 3 arguments. Call the method directly:[(UIApplication *)responder openURL:url options:0 completionHandler:nil];.openURL:options:completionHandler:directly on the application from an extension. That is evidently the restriction that the OP is trying to slide around.openURL...directly isn't allowed, then usingperformSelectorto call it shouldn't work either, right?openURLworks if you locate the application as a responder by walking the responder chain. You see, I've been doing this stuff a long time, so I recognize the pattern in the OP code. See stackoverflow.com/questions/27506413/… if you're curious. That the question itself is very confusingly written, is obvious.