0

I have a new Project from an older Member of our Team. I Don't know where the Problem is...

  // Chooses the photo at the last index
    [group enumerateAssetsAtIndexes:[NSIndexSet indexSetWithIndex:[group numberOfAssets] - 1] options:0 usingBlock:^(ALAsset *alAsset, NSUInteger index, BOOL *innerStop) {

        // The end of the enumeration is signaled by asset == nil.
        if (alAsset) {
            ALAssetRepresentation *representation = [alAsset defaultRepresentation];
            [defaults setObject:representation.filename forKey:@"latest"];
        }
    }];
} failureBlock: ^(NSError *error) {
    // Typically you should handle an error more gracefully than this.
    NSLog(@"No groups");
}];

2014-09-04 11:37:55.960 IMDropShare[28350:60b] WARNING: GoogleAnalytics 3.06 void GAIUncaughtExceptionHandler(NSException *) (GAIUncaughtExceptionHandler.m:49): Uncaught exception: indexSet count or lastIndex must not exceed -numberOfAssets 2014-09-04 11:38:00.980 IMDropShare[28350:60b] * Terminating app due to uncaught exception 'NSRangeException', reason: 'indexSet count or lastIndex must not exceed -numberOfAssets'

alexohneander
  • 519
  • 3
  • 7
  • 22
  • 1
    When `[group numberOfAssets]` is equal to 0, -1 will be converted to a very big unsigned integer value – KudoCC Sep 04 '14 at 09:50

1 Answers1

0

The Problem was, that no photo was in the Library....

For my Problem i add some Photo's and solved it!

alexohneander
  • 519
  • 3
  • 7
  • 22
  • Even though you got it working, this is **not** a solution. (One) solution would be to enclose the enumeration code in an `if` statement and execute only if their are images present in the gallery. – n00bProgrammer Sep 04 '14 at 12:12