【问题标题】:iOS: Today App Extension shows no body or freezes after main app is updatediOS:今日应用程序扩展在主应用程序更新后显示没有正文或冻结
【发布时间】:2016-10-25 07:32:20
【问题描述】:

通过 AdHoc 构建安装更新我的应用后,我无法使用今天的小部件。更新主应用后,今天的小部件似乎冻结了。

我参考了以下链接,但找不到解决方法。

Today Extension widget freezes when the main app is updated

Today widget not respond after app update

我面临上述两个链接中提到的类似问题。我尝试将preferredContentSize 设置如下,但似乎没有解决问题:

CGSize currentSize = self.preferredContentSize;
currentSize.height = 85.0;
self.preferredContentSize = currentSize;

如果我们重新启动手机,问题就会得到解决。

另外请注意,我正在为 iOS 7 到 iOS 9.3.5 提供支持。应用程序不兼容 iOS 10。

请发布您的 cmets/建议以解决此问题。

【问题讨论】:

    标签: ios widget today-extension app-update


    【解决方案1】:

    在这个方法中也改变preferredContentSize

    - (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode withMaximumSize:(CGSize)maxSize
    

    它看起来有点类似于:

    - (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode withMaximumSize:(CGSize)maxSize
    {
        if (activeDisplayMode == NCWidgetDisplayModeCompact)
            self.preferredContentSize = maxSize;
        else
        {
            self.preferredContentSize = CGSizeMake(0, 100*myArray.count);
        }
    }
    

    【讨论】:

    • 感谢您的回复。很抱歉,我忘记在我的帖子中提及,但这发生在 iOS 9.3.5 中,我还没有在我的应用程序中提供对 iOS 10 的支持。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多