I tried to set NSMutableArray
as object in NSUserDefault
.but it gives following error.
Attempt to set a non-property-list
this is how I tried it.
[[NSUserDefaults standardUserDefaults] setObject:OutboundArray forKey:@"outbound"];
[[NSUserDefaults standardUserDefaults] synchronize];
NOTE : OutboundArray
type is NSMutableArray. What is the wrong with this.I do this inside a method.hope your help.
this is how I assign value to OutboundArray
- (void)assignvaluedForarrays
{
OutboundArray = nil;
InboundArray = nil;
FlightSearchSelected *flightSearch = [FlightSearchSelected new];
JourneyTy = flightSearch.returnJType;
DirectRNot = flightSearch.returnNonStoporNot;
fromAcode = flightSearch.returnFromPort;
toAcode = flightSearch.returnToPort;
FlightCnt = FinalDetails.FlightCount;
OutboundArray = [NSMutableArray array];
InboundArray = [NSMutableArray array];
//all round trips
if ([JourneyTy isEqualToString:@"true"])
{
for (int i=0;i<FlightCnt;i++)
{
FinalValues *finalValue = testingArray[i];
NSString *legNumber = finalValue.legnumber;
if ([legNumber isEqualToString:@"1"])
{
[OutboundArray addObject:testingArray[i]];
}
else
{
[InboundArray addObject:testingArray[i]];
}
}
}
//only one ways trips
else
{
self.finaltableViewbottomLayout.constant = 180;
for (int i = 0;i<FlightCnt;i++)
{
[OutboundArray addObject:testingArray[i]];
}
}
}
*testingArray data comes from the previous view controller according to indexpath of the table view.