gpt4 book ai didi

ios - 包含数组对象的字典在将其传递给 WatchKit 扩展时崩溃

转载 作者:行者123 更新时间:2023-11-29 01:32:12 25 4
gpt4 key购买 nike

我在 watchkit 扩展委托(delegate)方法中创建了字典:

- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void(^)(NSDictionary *replyInfo))reply {

NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:customEntityArray,@"keyString",nil];
NSLog(@"dict is:%@", dict);
reply(dict);

}

其中 customEntityArray 是自定义类对象的数组。

当我尝试记录 dict - 它打印出正确的值:

Printing description of dict:
{
keyString = (
"<Entity: 0x7fa810e844d0>"
);
},

但是当我通过回复在 watchkit 扩展委托(delegate)方法中传递这个字典时,它在那里崩溃了 SIGABRT

最佳答案

sulabh,因为你有 customEntityArray,它是自定义类对象的数组。这就是您的应用程序崩溃的原因,您无法通过自定义类将数据从 iOS 应用程序传递到 watchkit 扩展。您必须避免将键值放在自定义类中,尝试从 NSMutableDictionaries 或其他方式传递键值。

关于ios - 包含数组对象的字典在将其传递给 WatchKit 扩展时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33339372/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com