I have to assign countries, states & cities getting in response from JSON, in an NSMutableArray, Which is initialized in Modal Class.
I will have to remove all objects in order to set new states and cities, doing that crashes with error
incorrect checksum for freed object - object was probably modified after being freed. *** set a breakpoint in malloc_error_break to debug
then in answer https://stackoverflow.com/a/12050676/5568169 came to know that assigning nil to mutableArray will work, and it worked, But now User can again select another country, So now allocating memory [myMutableArray alloc] init]]
, gives me the same error i was getting in starting.
-(void)fetchStates:(NSString*)idString {
[registrationModalContactVC.allStateArray removeAllObjects];
registrationModalContactVC.allStateArray = nil;
[registrationModalContactVC.allStateDict removeAllObjects];
registrationModalContactVC.allStateDict = nil;
registrationModalContactVC.allStateArray = [NSMutableArray new];
registrationModalContactVC.allStateDict = [NSMutableDictionary new];
}
Kindly help
i think your mutablearray is a datasource of a pickview , when you remove all objects, how is your pickview's status.