想知道最近是否有其他人遇到过这个问题......
对于我的一个视图控制器,仅在iOS 8上,在调用之后presentViewController:animated:completion:
,呈现的视图控制器self.presentingController
为零.它在iOS7上很好,也不会在另一个视图控制器上发生.
该文件说,它应该被设置,只要提交视图控制器是模态呈现.鉴于它适用于iOS 7,这可能是iOS 8的错误吗?
我已经能够使用视图容器包含方法来解决它,但如果有人之前已经看过它并且知道触发此行为的根本原因,那将会很好.
谢谢
在Objective-C中,NSSetUncaughtExceptionHandler
可以注册一些功能来做最后一分钟的异常日志记录.
这并没有抓住Swift崩溃的东西.
是否有可能在Swift的全球范围内做这样的事情?例如,如果在Swift代码中发生崩溃,请执行一些日志记录,例如强制解包nil可选.
具体来说,我正在做一个实用程序来记录应用程序中的网络流量,如果发生崩溃,我想将内存中的数据刷新到磁盘.
我发现了一个有趣的行为,似乎是一个bug ...
基于以下文章描述的行为:
https://medium.com/ios-os-x-development/swift-protocol-extension-method-dispatch-6a6bf270ba94
http://nomothetis.svbtle.com/the-ghost-of-swift-bugs-future
当我添加时SomeSuperclass
,输出不是我所期望的,而不是直接采用协议.
protocol TheProtocol {
func method1()
}
extension TheProtocol {
func method1() {
print("Called method1 from protocol extension")
}
func method2NotInProtocol() {
print("Called method2NotInProtocol from protocol extension")
}
}
// This is the difference - adding a superclass
class SomeSuperclass: TheProtocol {
}
// It works as expected when it simply adopts TheProtocol, but not when it inherits from a class that adopts the protocol
class MyClass: SomeSuperclass {
func method1() {
print("Called …
Run Code Online (Sandbox Code Playgroud)