Custom keyboard crashes in App Store, but not in when launched from Xcode

守給你的承諾、 提交于 2019-12-08 07:55:30

It appears from the stack trace that you use UIAppearance proxies to set up your App's appearance.

An interesting quirk of iOS extensions is that the customizations made in the other apps using this API are actually passed to extensions contained in the app (at least in the case of keyboard extensions).

To ensure security, all objects passed must be encoded using NSSecureCoding, which therefore requires that any objects you use in UIAppearance must conform to this protocol (and actually fulfill what it promises), as long as a user is using a keyboard extension in your app.

It appears that your app in this case is attempting to pass a color which can't be archived. Perhaps you are using an image as a color using +[UIColor colorWithPatternImage:], which would fit the error -- an image probably has no color in the sense UIColor means.

I recommend you audit your app's code for any instances where a UIAppearance is used to set a color, particularly when exotic calls like colorWithPatternedImage: are used, and remove them. Perhaps swizzle all UIAppearance calls to no-ops, push up an internal beta in TestFlight, and see if the problem is solved to confirm that this is the issue.

Regardless of which of these it is: File a bug with Apple. Apps should not crash just because they can't encode their UIAppearance correctly, especially when doing something that is, frankly, undesirable.

EDIT: it is possible to reproduce this issue without using TestFlight, whilst running an app in release (you can turn this on by going to product->scheme->edit scheme) by adding a line of code to set the background color of a UIButton to a UIColor which is a patterned color, then invoking a keyboard extension.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!