与App Group的NSUserDefault无法在iOS 8 Beta3中运行 [英] NSUserDefault with App Group is not working in iOS 8 Beta3

查看:381
本文介绍了与App Group的NSUserDefault无法在iOS 8 Beta3中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用自定义键盘扩展程序在我的应用程序中将布尔值保存到 NSUserDefault 并与App Group分享。

I have to save Boolean Value to NSUserDefault in my App with custom keyboard extension and share with App Group.

我的代码在 iOS 8 Beta1中运行。

My Code is worked in iOS 8 Beta1.

self.defaults = [NSUserDefaults standardUserDefaults];

if([self.defaults boolForKey:@"BlackKey"])
    {
        NSLog(@"Black");
    }

    else
    {
        NSLog(@"White");
    }

但不是iOS 8 Beta3。当我从 NSUserDefault 中检索 Boolean 值时,它什么都不返回,我无法从自定义键盘扩展中加载。

But Not in iOS 8 Beta3. When i retrieve Boolean value from NSUserDefault , it's return nothing and i can't load from custom keyboard extension.

我还尝试在 NSUserDefault 中使用 initWithSuiteName 。我只针对那个问题或iOS 8 Beta3的错误吗?

I have also tried with initWithSuiteName in NSUserDefault. Am i only one for that problem or bugs of iOS 8 Beta3?

推荐答案

一些可能的解决方案是:

A few probable solutions are:


  1. 您的应用程序组设置不正确,或者您没有使用正确的组标识符 initWithSuiteName:

您尚未为键盘启用网络访问权限。 本文档在您为键盘禁用网络访问时指出以下内容(默认行为):

You have not enabled network access for your keyboard. This document states the following when you have network access disabled for your keyboard (default behavior):


不共享包含app的容器

No shared container with containing app


  • 这是一个错误。

  • It's a bug.

    这篇关于与App Group的NSUserDefault无法在iOS 8 Beta3中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆