iOS9故事板什么是未处理的动作(handlenonlaunchspecific动作)?

时间:2022-09-10 19:14:15

I've noticed the following error popping up in the console when running my app on iOS 9 when using a storyboard. I'm using xCode7. Is this something I need to be concerned about?

我注意到在使用故事板时,在ios9上运行我的应用程序时,控制台会弹出以下错误。我用xCode7。这是我需要关注的吗?

-[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] ** unhandled action -> <FBSSceneSnapshotAction: 0x176bfb20> {
    handler = remote;
    info = <BSSettings: 0x176a5d90> {
        (1) = 5;
    };
}

4 个解决方案

#1


32  

There is nothing wrong with your code. This is a logging message internal to Apple, and you should file a radar about it.

您的代码没有问题。这是苹果公司内部的日志信息,您应该对它进行归档。

There are two hints that show that this is probably Apple's code:

有两个线索表明这可能是苹果的代码:

  1. The underscore leading the method name _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion is a convention indicating that the method is private/internal to the class that it's declared in. (See this comment.)

    在方法名_handlenonlaunchspecific action前面的下划线:forScene:withTransitionContext:completion是一个约定,表明该方法对于它声明的类来说是私有的/内部的。(看到这个评论。)

  2. It's reasonable to guess that the two letter prefix in FBSSceneSnapshotAction is shorthand for FrontBoard, which according to Rene Ritchie in "iOS 9 wish-list: Guest Mode" is part of the whole family of software related to launching apps:

    我们有理由猜测FBSSceneSnapshotAction中的两个字母前缀是FrontBoard的缩写,根据Rene Ritchie在“ios9 wish-list: Guest模式”中的说法,它是与发布应用程序相关的整个系列软件的一部分:

With iOS 8, Apple refactored its system manager, SpringBoard, into several smaller, more focused components. In addition to BackBoard, which was already spun off to handle background tasks, they added Frontboard for foreground tasks. They also added PreBoard to handle the Lock screen under secure, encrypted conditions. [...]

通过iOS 8,苹果将其系统管理器SpringBoard重构为几个更小、更专注的组件。除了用于处理后台任务的后板之外,他们还为前台任务添加了前板。他们还添加了PreBoard,以在安全、加密的条件下处理锁屏。[…]

I have no idea what the BS prefix in BSSettings is for, but

我不知道BSSettings中的BS前缀是用来做什么的,但是

BS is shorthand for BackBoard Settings, and an analysis of this log message would indicate that it's not anything you did, and you should file a radar with steps to reproduce the logging message.

BS是BackBoard设置的简写,对日志消息的分析将表明这不是您所做的任何事情,您应该对一个包含复制日志消息步骤的雷达文件进行归档。

If you want to try and grab a stack trace, you can implement the category linked to here. Some would argue that overriding private API is a bad idea, but in this case a temporary injection to grab a stack trace can't be too harmful.

如果您想尝试获取堆栈跟踪,可以实现链接到这里的类别。一些人认为,覆盖私有API是一个坏主意,但是在这种情况下,临时注入来获取堆栈跟踪不会太有害。

EDIT:

编辑:

But, we still want to know what this action is. So I put a breakpoint on -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion] and started printing out register values and found a class called FBSceneImpl which had a whole bunch of information about my application:

但是,我们仍然想知道这个行为是什么。因此,我在-[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion]上设置了一个断点,然后开始打印寄存器值,发现了一个名为FBSceneImpl的类,它包含了关于我的应用程序的大量信息:

iOS9故事板什么是未处理的动作(handlenonlaunchspecific动作)?

We are able to find out which private method is called next (stored in the program counter, instruction pointer, register 15.)

我们可以找到下一个私有方法(存储在程序计数器中,指令指针,寄存器15)。

iOS9故事板什么是未处理的动作(handlenonlaunchspecific动作)?

I tried finding the un-handled FBSceneSnapshotAction referenced in the log, but no dice. Then, I subclassed UIApplication, and overrode _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion. Now I was able to get at the action directly, but still, we don't know what it is.

我试图找到日志中引用的未处理的FBSceneSnapshotAction,但没有骰子。然后,我对UIApplication进行子类化,并覆盖_handleNonLaunchSpecificActions:forScene:withTransitionContext:completion。现在我可以直接进行操作了,但我们仍然不知道它是什么。

Then, I looked at the FBSceneSnapshotAction again. Turns out it has a superclass called BSAction.

然后,我又看了看FBSceneSnapshotAction。原来它有一个叫做BSAction的超类。

Then I wrote a tool similar to RuntimeBrowser and looked up all of the subclasses of BSAction. It turns out that there's quite a list of them:

然后我编写了一个类似于RuntimeBrowser的工具,并查找了BSAction的所有子类。事实证明,他们有很多

iOS9故事板什么是未处理的动作(handlenonlaunchspecific动作)?

The two method names we have (one from the log and one from the program counter on the devices) indicate that these actions are used under the hood for passing actions around the system.

我们拥有的两个方法名(一个来自日志,另一个来自设备上的程序计数器)表明,这些操作在引擎盖下用于在系统中传递操作。

Some actions are probably sent up to the app delegate's callbacks, while others are handled internally.

一些操作可能被发送到应用委托的回调,而另一些操作则在内部处理。

What's happening here is that there is an action that wasn't handled correctly and the system is noting it. We weren't supposed to see it, apparently.

这里发生的是,有一个操作没有被正确处理,系统正在记录它。显然,我们不应该看到它。

#2


12  

AFAIK, the info above is related to iOS during snapshot the screen (i suppose for double click home multitask related behaviour).I deeply investigated my application and seems that it does not get any side behaviours. You can safely ignore it, for now.

AFAIK,上面的信息是在屏幕快照期间与iOS相关的(我想双击home multitask相关的行为)。我对我的申请进行了深入的调查,似乎没有发现任何副作用。现在你可以放心地忽略它。

You can use the following gist simple category to test yourself against the calls to the above function:

您可以使用以下要点简单的类别来测试您对上述函数的调用:

#3


1  

I have figured it out, it will happen when you have IBAction method declared in .h or .m file but you have not bind it to any control.

我已经弄明白了,当您在.h或.m文件中声明了IBAction方法,但是您没有将它绑定到任何控件时,就会发生这种情况。

.m example:

00的例子:

- (IBAction)click:(id)sender{
}

but not assigned this method to any control in storyboard.

但是没有将这个方法分配给故事板中的任何控件。

#4


1  

haven't find out why it happens in my app, but at least you can catch the exception, if you want to keep this from popping up in your log pane. It's not a solution, but it might give you more insight why it is happing by inspecting any of the arguments that are passed in the catch.

我还没弄清楚为什么会发生在我的应用程序中,但如果你想防止这个异常出现在你的日志窗格中,至少你可以捕获这个异常。它不是一种解决方案,但是它可以通过检查在捕获中传递的任何参数使您更深入地了解为什么会发生这种情况。

swift 2 version:

斯威夫特2版本:

import UIKit

extension UIApplication {
    func _handleNonLaunchSpecificActions(arg1: AnyObject, forScene arg2: AnyObject, withTransitionContext arg3: AnyObject, completion completionHandler: () -> Void) {
        //whatever you want to do in this catch
        print("handleNonLaunchSpecificActions catched")
    }
}

#1


32  

There is nothing wrong with your code. This is a logging message internal to Apple, and you should file a radar about it.

您的代码没有问题。这是苹果公司内部的日志信息,您应该对它进行归档。

There are two hints that show that this is probably Apple's code:

有两个线索表明这可能是苹果的代码:

  1. The underscore leading the method name _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion is a convention indicating that the method is private/internal to the class that it's declared in. (See this comment.)

    在方法名_handlenonlaunchspecific action前面的下划线:forScene:withTransitionContext:completion是一个约定,表明该方法对于它声明的类来说是私有的/内部的。(看到这个评论。)

  2. It's reasonable to guess that the two letter prefix in FBSSceneSnapshotAction is shorthand for FrontBoard, which according to Rene Ritchie in "iOS 9 wish-list: Guest Mode" is part of the whole family of software related to launching apps:

    我们有理由猜测FBSSceneSnapshotAction中的两个字母前缀是FrontBoard的缩写,根据Rene Ritchie在“ios9 wish-list: Guest模式”中的说法,它是与发布应用程序相关的整个系列软件的一部分:

With iOS 8, Apple refactored its system manager, SpringBoard, into several smaller, more focused components. In addition to BackBoard, which was already spun off to handle background tasks, they added Frontboard for foreground tasks. They also added PreBoard to handle the Lock screen under secure, encrypted conditions. [...]

通过iOS 8,苹果将其系统管理器SpringBoard重构为几个更小、更专注的组件。除了用于处理后台任务的后板之外,他们还为前台任务添加了前板。他们还添加了PreBoard,以在安全、加密的条件下处理锁屏。[…]

I have no idea what the BS prefix in BSSettings is for, but

我不知道BSSettings中的BS前缀是用来做什么的,但是

BS is shorthand for BackBoard Settings, and an analysis of this log message would indicate that it's not anything you did, and you should file a radar with steps to reproduce the logging message.

BS是BackBoard设置的简写,对日志消息的分析将表明这不是您所做的任何事情,您应该对一个包含复制日志消息步骤的雷达文件进行归档。

If you want to try and grab a stack trace, you can implement the category linked to here. Some would argue that overriding private API is a bad idea, but in this case a temporary injection to grab a stack trace can't be too harmful.

如果您想尝试获取堆栈跟踪,可以实现链接到这里的类别。一些人认为,覆盖私有API是一个坏主意,但是在这种情况下,临时注入来获取堆栈跟踪不会太有害。

EDIT:

编辑:

But, we still want to know what this action is. So I put a breakpoint on -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion] and started printing out register values and found a class called FBSceneImpl which had a whole bunch of information about my application:

但是,我们仍然想知道这个行为是什么。因此,我在-[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion]上设置了一个断点,然后开始打印寄存器值,发现了一个名为FBSceneImpl的类,它包含了关于我的应用程序的大量信息:

iOS9故事板什么是未处理的动作(handlenonlaunchspecific动作)?

We are able to find out which private method is called next (stored in the program counter, instruction pointer, register 15.)

我们可以找到下一个私有方法(存储在程序计数器中,指令指针,寄存器15)。

iOS9故事板什么是未处理的动作(handlenonlaunchspecific动作)?

I tried finding the un-handled FBSceneSnapshotAction referenced in the log, but no dice. Then, I subclassed UIApplication, and overrode _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion. Now I was able to get at the action directly, but still, we don't know what it is.

我试图找到日志中引用的未处理的FBSceneSnapshotAction,但没有骰子。然后,我对UIApplication进行子类化,并覆盖_handleNonLaunchSpecificActions:forScene:withTransitionContext:completion。现在我可以直接进行操作了,但我们仍然不知道它是什么。

Then, I looked at the FBSceneSnapshotAction again. Turns out it has a superclass called BSAction.

然后,我又看了看FBSceneSnapshotAction。原来它有一个叫做BSAction的超类。

Then I wrote a tool similar to RuntimeBrowser and looked up all of the subclasses of BSAction. It turns out that there's quite a list of them:

然后我编写了一个类似于RuntimeBrowser的工具,并查找了BSAction的所有子类。事实证明,他们有很多

iOS9故事板什么是未处理的动作(handlenonlaunchspecific动作)?

The two method names we have (one from the log and one from the program counter on the devices) indicate that these actions are used under the hood for passing actions around the system.

我们拥有的两个方法名(一个来自日志,另一个来自设备上的程序计数器)表明,这些操作在引擎盖下用于在系统中传递操作。

Some actions are probably sent up to the app delegate's callbacks, while others are handled internally.

一些操作可能被发送到应用委托的回调,而另一些操作则在内部处理。

What's happening here is that there is an action that wasn't handled correctly and the system is noting it. We weren't supposed to see it, apparently.

这里发生的是,有一个操作没有被正确处理,系统正在记录它。显然,我们不应该看到它。

#2


12  

AFAIK, the info above is related to iOS during snapshot the screen (i suppose for double click home multitask related behaviour).I deeply investigated my application and seems that it does not get any side behaviours. You can safely ignore it, for now.

AFAIK,上面的信息是在屏幕快照期间与iOS相关的(我想双击home multitask相关的行为)。我对我的申请进行了深入的调查,似乎没有发现任何副作用。现在你可以放心地忽略它。

You can use the following gist simple category to test yourself against the calls to the above function:

您可以使用以下要点简单的类别来测试您对上述函数的调用:

#3


1  

I have figured it out, it will happen when you have IBAction method declared in .h or .m file but you have not bind it to any control.

我已经弄明白了,当您在.h或.m文件中声明了IBAction方法,但是您没有将它绑定到任何控件时,就会发生这种情况。

.m example:

00的例子:

- (IBAction)click:(id)sender{
}

but not assigned this method to any control in storyboard.

但是没有将这个方法分配给故事板中的任何控件。

#4


1  

haven't find out why it happens in my app, but at least you can catch the exception, if you want to keep this from popping up in your log pane. It's not a solution, but it might give you more insight why it is happing by inspecting any of the arguments that are passed in the catch.

我还没弄清楚为什么会发生在我的应用程序中,但如果你想防止这个异常出现在你的日志窗格中,至少你可以捕获这个异常。它不是一种解决方案,但是它可以通过检查在捕获中传递的任何参数使您更深入地了解为什么会发生这种情况。

swift 2 version:

斯威夫特2版本:

import UIKit

extension UIApplication {
    func _handleNonLaunchSpecificActions(arg1: AnyObject, forScene arg2: AnyObject, withTransitionContext arg3: AnyObject, completion completionHandler: () -> Void) {
        //whatever you want to do in this catch
        print("handleNonLaunchSpecificActions catched")
    }
}