当我使用 json 网络服务并将值存储在 NSMutablearray 中时,我得到了 Null 响应。现在我想删除该 null 值并将其替换为空值。谁能帮我解决这个错误。
(
{
Aadhar =1123323244;
AddressProofCopy = "<null>";
Advertisement = "<null>";
AgreementCopy = "<null>";
ApCity = ggg;
ApDistrict = g;
ApDoorNo = g;
ApFGFirstName = v;
ApFGSurName = g;
ApGender = F;
ApPIN = 12323;
ApStreet = h;
AppStatus = "<null>";
ApplRefStageStatus = N;
ApplicantFirstName = g;
ApplicantPhoto = "<null>";
ApplicantSurName = g;
ApplicationDate = "2018-09-06T00:00:00.000Z";
ApplicationType = New;
BuldingType = "<null>";
District = 132424;
DistrictId = 11;
DocVerifiedBy = "<null>";
DocVerifiedDate = "<null>";
DocVerifiedMessage = "<null>";
DocVerifiedStatus = "<null>";
}
)
最佳答案
请验证此链接.. https://github.com/bismasaeed00/NullReplacer它对我来说工作正常。
试试这个..
#import "NSArray+NullReplacement.h"
#import "NSDictionary+NullReplacement.h"
之后,根据使用下面的行传递您的字典/数组 JSON 响应,
NSArray *newvalue = [yourarrayresponse arrayByReplacingNullsWithBlanks];
或
NSDictionary *newvalue = [yourdictionary dictionaryByReplacingNullsWithBlanks];
如果你得到任何错误,只需添加
#import "NSArray+NullReplacement.h"
在NSDictionary+NullReplacement类中
#import "NSDictionary+NullReplacement.h"
在 NSDictionary+NullReplacement 类文件中。
关于ios - 如何从 objective-c 中的 NSMutablearray 中删除空值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52200344/