index 0 beyond bounds for empty array while getting to the documents directory
问题 I use the following code to get to the documents directory. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; Why would my app be crashing with the following message? *** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array I can't see how my NSArray (immutable array) can be empty. The function is supposed to return the documents folder in an array. Any ideas? 回答1: 1) Are you