ios - How to send Parse query into another ViewController -
i'm trying send on query salesarray = [[nsmutablearray alloc]initwitharray:objects] editdata, can't life of me figure out. i'm trying fill picker view..i query executed [parseconnection parseproduct] can't array on editdata.m
parseconnection.h
#import <foundation/foundation.h> #import <parse/parse.h> #import "constants.h" //#import "editdata.h" @protocol parseconnectiondelegate <nsobject> @end @interface parseconnection : nsobject //<pfsubclassing> { nsmutablearray *salesarray, *callbackarray, *contractorarray, *ratearray, *ziparray, *jobarray; } - (void)parsesalesman; @property (strong, nonatomic) id<parseconnectiondelegate> delegate; //added @property (strong, nonatomic) uitextfield *salesname;
parseconnection.m
#import "parseconnection.h" @interface parseconnection () { // nsmutablearray *salesarray, *callbackarray, *contractorarray, *ratearray, *ziparray, *jobarray; } @end @implementation parseconnection #pragma mark - editdata pickerview - (void)parsesalesman { pfquery *query = [pfquery querywithclassname:@"salesman"]; query.cachepolicy = kpfcachepolicy; [query selectkeys:@[@"salesno"]]; [query selectkeys:@[@"salesman"]]; [query orderbydescending:@"salesno"]; [query wherekey:@"active" containsstring:@"active"]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { salesarray = [[nsmutablearray alloc]initwitharray:objects]; // nslog(@"adstr %@",salesarray); }]; }
editdata.m
#import "editdata.h" @interface editdata () { nsmutablearray *salesarray, *callbackarray, *contractorarray, *ratearray; } @property (nonatomic, weak) uistepper *defaultstepper; @end @implementation editdata @synthesize custno, leadno, active, date, first, last, company, address, city, state, zip, phone, aptdate, email, amount, spouse, callback, saleno, jobno, adno, photo, comment, rate, start, complete; - (void)viewdidload { [super viewdidload]; self.edgesforextendedlayout = uirectedgenone; //fix self.listtableview.datasource = self; self.listtableview.delegate = self; self.listtableview.rowheight = uitableviewautomaticdimension; self.listtableview.estimatedrowheight = row_height; self.listtableview.contentinset = uiedgeinsetsmake(10, 0, 0, 0); // self.listtableview.tableheaderview = view; //makes header move tablecell parseconnection *parseconnection = [[parseconnection alloc]init]; [parseconnection parseproduct]; nslog(@"adstr %@",self.adname.text); }
instead of creating salesarray
inside parseconnection
, pass in 1 have inside editdata
. then, in completion block, add objects rather initializing it.
don't forget init salesarray
in editdata
before passing parameter parse...
method.
Comments
Post a Comment