You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@usergrid.apache.org by Alex Muramoto <am...@apigee.com> on 2014/11/05 20:29:43 UTC
Re: collection paging
Hi Jason
This bug was fixed and merged on github this morning. You can get it at https://github.com/apigee/apigee-ios-sdk <https://github.com/apigee/apigee-ios-sdk>.
Best,
Alex
--
Alex Muramoto | apigee <http://www.apigee.com/> | twitter @apigee <https://twitter.com/apigee>
> On Oct 30, 2014, at 8:10 PM, jasonk@apps4u.com.au wrote:
>
> Thank you heap I knew I was not losing my mind .. I did look at the SDK and I saw fetch being called but I could not find the query being added as I was trying to debug it by printing the query . So thanks agin and sorry for posting a question about ApigeeSDk on this mailing list.
>
>
> October 31 2014 7:23 AM, "Alex Muramoto" <amuramoto@apigee.com <ma...@apigee.com>> wrote:
>> Hi Jason
>>
>> This appears to be a bug in the SDK. When the getNextPage method is calling [ApigeeCollection
>> fetch], the query on self isn’t being constructed. I’ll forward this on to Apigee’s SDK developer
>> and ask him to put in a fix.
>>
>> Best,
>>
>> Alex
>>
>> --
>> Alex Muramoto | apigee <http://www.apigee.com/ <http://www.apigee.com/>> | twitter @apigee <https://twitter.com/apigee <https://twitter.com/apigee>>
>>
>>> On Oct 30, 2014, at 1:21 AM, jasonk@apps4u.com.au wrote:
>>>
>>> Hi I'm sorry for asking this on the mail list but Im at my wits end Ive been stuck on this for
>> two
>>> days and I can not seem to get paging working using the apigee iOS sdks.
>>> Ive added the code snippet below, Ive tried the sample collection application in the sdks but it
>>> two is not working it returns the same ten entities each time even when you click on the paging
>>> button Ive tried the sample collection app with my collection that has 3000 entities in it . as
>> you
>>> can see below Ive got a UITable view and Im trying to page the data so the user get to the last
>> row
>>> if their is a next page It then fetches the next page of entities but all I keep getting it 100's
>>> of row of the same ten entities so if some can see if Im doing some thing wrong .. Please help
>> Ive
>>> going crazy of this not work as I can not debug the fault and Ive alway thought I was a very good
>>> iOS programming.
>>>
>>> -(void)fetchCollection {
>>>
>>> if(self.cursor == nil){
>>>
>>> self.collection = [self.dataClient getCollection:@"shops"];
>>>
>>> // self.cursor = [self.collection cursor];
>>>
>>> do {
>>>
>>> Job *job = [[Job alloc] initWithEntity:[self.collection getNextEntity]];
>>>
>>> [self.jobsArray addObject:job];
>>>
>>> } while ([self.collection hasNextEntity]);
>>>
>>> self.cursor = [self.collection cursor];
>>> [self.tableView reloadData];
>>> }
>>> if (self.cursor != nil) {
>>>
>>> if([self.collection hasNextPage]) {
>>>
>>> [self.collection getNextPage];
>>>
>>> [self.collection resetEntityPointer];
>>> /// this was just some debuging.
>>> // ApigeeClientResponse *res = [self.collection getNextPage];
>>> // NSLog(@"count: %lu", (unsigned long)res.entityCount);
>>> // NSArray *array = res.response[@"entities"];
>>> // for (NSMutableDictionary *job in array) {
>>> // Job *tmp = [[Job alloc] initWithDict:job];
>>> // if(![self.jobsArray containsObject:tmp]){
>>> // [self.jobsArray addObject:tmp];
>>> // }
>>> // }
>>> while ([self.collection hasNextEntity]){
>>> Job *tmp = [[Job alloc] initWithEntity:[self.collection getNextEntity]];
>>> // if(![self.jobsArray containsObject:tmp]){
>>> [self.jobsArray addObject:tmp];
>>> // }
>>> } ;
>>>
>>> [self.tableView reloadData];
>>> }
>>>
>>> }
>>>
>>> }
Re: collection paging
Posted by ja...@apps4u.com.au.
cool I ended up just use getEntities with a query and managing the cursor my self which turned out ok or better as I could use the block based api to get the fetch off the main thread which is working real well with a collection with over 3000 entities and even when testing with read slow network I a responsive UITable View.
November 6 2014 5:32 AM, "Alex Muramoto" <am...@apigee.com> wrote:
> Hi Jason
>
> This bug was fixed and merged on github this morning. You can get it at
> https://github.com/apigee/apigee-ios-sdk <https://github.com/apigee/apigee-ios-sdk>.
>
> Best,
>
> Alex
>
> --
> Alex Muramoto | apigee <http://www.apigee.com/> | twitter @apigee <https://twitter.com/apigee>
>
>> On Oct 30, 2014, at 8:10 PM, jasonk@apps4u.com.au wrote:
>>
>> Thank you heap I knew I was not losing my mind .. I did look at the SDK and I saw fetch being
>> called but I could not find the query being added as I was trying to debug it by printing the
> query
>> . So thanks agin and sorry for posting a question about ApigeeSDk on this mailing list.
>>
>> October 31 2014 7:23 AM, "Alex Muramoto" <amuramoto@apigee.com <ma...@apigee.com>>
>> wrote:
>>> Hi Jason
>>>
>>> This appears to be a bug in the SDK. When the getNextPage method is calling [ApigeeCollection
>>> fetch], the query on self isn’t being constructed. I’ll forward this on to Apigee’s SDK
> developer
>>> and ask him to put in a fix.
>>>
>>> Best,
>>>
>>> Alex
>>>
>>> --
>>> Alex Muramoto | apigee <http://www.apigee.com/ <http://www.apigee.com/>> | twitter @apigee
>>> <https://twitter.com/apigee <https://twitter.com/apigee>>
>>>
>>>> On Oct 30, 2014, at 1:21 AM, jasonk@apps4u.com.au wrote:
>>>>
>>>> Hi I'm sorry for asking this on the mail list but Im at my wits end Ive been stuck on this for
>>>
>>> two
>>>> days and I can not seem to get paging working using the apigee iOS sdks.
>>>> Ive added the code snippet below, Ive tried the sample collection application in the sdks but
> it
>>>> two is not working it returns the same ten entities each time even when you click on the paging
>>>> button Ive tried the sample collection app with my collection that has 3000 entities in it . as
>>>
>>> you
>>>> can see below Ive got a UITable view and Im trying to page the data so the user get to the last
>>>
>>> row
>>>> if their is a next page It then fetches the next page of entities but all I keep getting it
>> 100's
>>>> of row of the same ten entities so if some can see if Im doing some thing wrong .. Please help
>>>
>>> Ive
>>>> going crazy of this not work as I can not debug the fault and Ive alway thought I was a very
>> good
>>>> iOS programming.
>>>>
>>>> -(void)fetchCollection {
>>>>
>>>> if(self.cursor == nil){
>>>>
>>>> self.collection = [self.dataClient getCollection:@"shops"];
>>>>
>>>> // self.cursor = [self.collection cursor];
>>>>
>>>> do {
>>>>
>>>> Job *job = [[Job alloc] initWithEntity:[self.collection getNextEntity]];
>>>>
>>>> [self.jobsArray addObject:job];
>>>>
>>>> } while ([self.collection hasNextEntity]);
>>>>
>>>> self.cursor = [self.collection cursor];
>>>> [self.tableView reloadData];
>>>> }
>>>> if (self.cursor != nil) {
>>>>
>>>> if([self.collection hasNextPage]) {
>>>>
>>>> [self.collection getNextPage];
>>>>
>>>> [self.collection resetEntityPointer];
>>>> /// this was just some debuging.
>>>> // ApigeeClientResponse *res = [self.collection getNextPage];
>>>> // NSLog(@"count: %lu", (unsigned long)res.entityCount);
>>>> // NSArray *array = res.response[@"entities"];
>>>> // for (NSMutableDictionary *job in array) {
>>>> // Job *tmp = [[Job alloc] initWithDict:job];
>>>> // if(![self.jobsArray containsObject:tmp]){
>>>> // [self.jobsArray addObject:tmp];
>>>> // }
>>>> // }
>>>> while ([self.collection hasNextEntity]){
>>>> Job *tmp = [[Job alloc] initWithEntity:[self.collection getNextEntity]];
>>>> // if(![self.jobsArray containsObject:tmp]){
>>>> [self.jobsArray addObject:tmp];
>>>> // }
>>>> } ;
>>>>
>>>> [self.tableView reloadData];
>>>> }
>>>>
>>>> }
>>>>
>>>> }