I am trying to save the indexPath for UICollectionView, but I get the following error:
libc++abi.dylib: terminating with uncaught exception of type NSException
My code is: Save index path:
[[NSUserDefaults standardUserDefaults] setObject:indexPath forKey:@"CollectionIndex"];
[[NSUserDefaults standardUserDefaults] synchronize];
Load indexPath:
NSIndexPath *storedIndexPath = [[NSUserDefaults standardUserDefaults] objectForKey:@"CollectionIndex"];
I have commented out code to find out which code that makes the error, and it is the code I am using to save the indexPath that creates the SIGABRT error.
Read the documentation of
NSUserDefaults > setObjectForKey
:To save an indexPath in the UserDefaults, you would have to make another representation, e.g. as a dictionary: