0

I'm trying to use the code from here: https://github.com/leah/PullToRefresh

but when I too big of a "pull height", I get a crash and this message:

NSArrayM objectAtIndex: index 5 beyond bounds for empty array

If my tableview cell only visit 4 cells, the crash message is instead

NSArrayM objectAtIndex: index 4 beyond bounds for empty array

etc. Please advise.

1 Answer 1

1

Of course it is beyond bounds: your array is empty, you can not extract any object form it.

If the array has n objects, you can retrieve up to index n - 1. An empty array has 0 objects, so you can not even retrieve index 0.

Sign up to request clarification or add additional context in comments.

9 Comments

Well, then the second line of code ("data = [NSData...") is causing the crash; but I don't see any array. Perhaps urlAddress is already deallocated and the array error comes from inside URLWithString:?
Try NSLog("Address String: %@", urlAddress); instead of data = [NSData dataWithContentsOfURL: [NSURL URLWithString: urlAddress] options:0 error:&error1];
when i pull height < cell height all is ok,but when > cell height,my code is wrong
The NSURL created from the string is valid too? Try NSURL* url = [NSURL URLURLWithString: urlAddress]; data = [NSData dataWithContentsOfURL: url options:0 error:&error1]; and see if url is always not-nil
NSLog(@"Address URL: %@", [NSURL URLWithString: urlAddress]); not nil
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.