objective-c - Coredata 中的 __NSSingleObjectArrayI
问题描述
我正在使用 Coredata。当我获取我的关系时,我与实体有关系,它提供了 NSSet,我将其转换为带有 AllObjects 的 NSMutableArray。它给我的问题是 __NSSingleObjectArrayI 而不是 NSMutableArray。任何人都可以帮我解决这个问题。谢谢
累了代码: -
NSSet *arrPayment = [[[dictPaymentData allValues] valueForKey:@"paymentToInvoice"] valueForKey:@"invoiceToPeople"];
NSMutableArray *arrData = [NSMutableArray arrayWithArray:[arrPayment allObjects]];
这是我的 __NSSingleObjectArrayI 代码:-
<__NSArrayM 0x6000018464f0>(
<__NSSingleObjectArrayI 0x600000a8bdd0>(
{(
<People: 0x600002b44370> (entity: People; id: 0x91782a4d7073f8e8 <x-coredata://0785667E-51C4-4C34-B696-C4374F6315D4/People/p630> ; data: {
archiveStatus = 0;
defaultTerms = 30;
email = nil;
extra1 = nil;
extra2 = nil;
extra3 = nil;
faxNo = nil;
firstName = nil;
from = nil;
fromid = 0;
homeNo = nil;
internalNotes = nil;
lastName = nil;
mobileNO = nil;
modificationDate = "2019-01-17 11:58:50 +0000";
organization = Yogesh;
peopleId = 0;
"sa_City" = nil;
"sa_Country" = nil;
"sa_State" = nil;
"sa_Street1" = nil;
"sa_Street2" = nil;
"sa_Zip" = nil;
selectedCurrency = "en_US";
signature = nil;
sortingString = nil;
status = Cactive;
syncID = nil;
uniqueIdentifier = "6A819F69-DCB0-4B6C-BE60-03151B23541D-3341-0000043F5397E622";
userId = nil;
vatNo = nil;
})
)}
)
)
,
解决方案
valueForKey:
有特殊的行为。应用于数组,它总是返回给定键的所有值的数组。
你最好使用objectForKey:
推荐阅读
- python - 如何在基于类的密码重置视图中使用占位符?
- flutter - 开发服务器上的 Flutter 驱动程序失败(无法连接到 Chrome 调试端口:37475)
- reactjs - Invariant Violation: The navigation prop is missing for this navigator. In react-navigation v3 and v4 you must set up your app container directly
- spring-boot - 如何在 SQS 通信中使用记录 Sleuth Trace ID 来配置 JMS 侦听器
- ios - Swizzling、模拟器和远程推送通知 - iOS 14
- node.js - 在容器中运行的nodejs api无法连接到服务器
- spring-boot - Spring Security OAuth2 Authorization Server 可以横向扩展吗?
- python - 我如何在谷歌浏览器中运行这个 python+ selenium webdriver 代码?
- api - Flutter:在 null 上调用了 getter 'length'
- java - java访问公共类方法而不创建对象