xcode - send file using bump -
i have implemented correctly bump's api, , added code:
- (void) configurebump { [bumpclient configurewithapikey:@"your api key" anduserid:[[uidevice currentdevice] name]]; [[bumpclient sharedclient] setmatchblock:^(bumpchannelid channel) { /* uialertview *alert=[[uialertview alloc] initwithtitle:@"matched user" message:nil delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil ]; [alert show]; [alert release];*/ nslog(@"matched user: %@", [[bumpclient sharedclient] useridforchannel:channel]); [[bumpclient sharedclient] confirmmatch:yes onchannel:channel]; }]; [[bumpclient sharedclient] setchannelconfirmedblock:^(bumpchannelid channel) { /* uialertview *alert=[[uialertview alloc] initwithtitle:@"channel with" message:nil delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil ]; [alert show]; [alert release];*/ nslog(@"channel %@ confirmed.", [[bumpclient sharedclient] useridforchannel:channel]); [[bumpclient sharedclient] senddata:[[nsstring stringwithformat:@"hi"] datausingencoding:nsutf8stringencoding] tochannel:channel]; }]; [[bumpclient sharedclient] setdatareceivedblock:^(bumpchannelid channel, nsdata *data) { uialertview *alert=[[uialertview alloc] initwithtitle:@"data received" message:[nsstring stringwithcstring:[data bytes] encoding:nsutf8stringencoding] delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil ]; [alert show]; [alert release]; nslog(@"data received %@: %@", [[bumpclient sharedclient] useridforchannel:channel], [nsstring stringwithcstring:[data bytes] encoding:nsutf8stringencoding]); nsstring *receivedbumpdata=[nsstring stringwithcstring:[data bytes] encoding:nsutf8stringencoding]; if(receivedbumpdata.length!=0){ cardavailablelandscape *cardobject=[[cardavailablelandscape alloc] init]; [cardobject bumpinsertfunction:receivedbumpdata]; } }]; [[bumpclient sharedclient] setconnectionstatechangedblock:^(bool connected) { if (connected) { /* uialertview *alert=[[uialertview alloc] initwithtitle:@"bump coneected" message:nil delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil ]; [alert show]; [alert release];*/ nslog(@"bump connected..."); } else { /* uialertview *alert=[[uialertview alloc] initwithtitle:@"bump disconnected..." message:nil delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil ]; [alert show]; [alert release];*/ nslog(@"bump disconnected..."); } }]; [[bumpclient sharedclient] setbumpeventblock:^(bump_event event) { switch(event) { case bump_event_bump:{ /*uialertview *alert=[[uialertview alloc] initwithtitle:@"bump detected." message:nil delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil ]; [alert show]; [alert release];*/ nslog(@"bump detected."); break; } case bump_event_no_match: { /*uialertview *alert=[[uialertview alloc] initwithtitle:@"no match." message:nil delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil ]; [alert show]; [alert release];*/ nslog(@"no match."); break; } } }]; } this code has been taken example project. connection established. can't seem able send file: tried tutorial:
http://appgenor.blogspot.it/2010/02/using-bumps-new-api-to-exchange-data.html
but bumb object can not created. gives me error. bump has not been implemented. not in sdk, think...
bumpobject = [[bump alloc] init]; // bump *bumpobject; help please!!
i looked @ link mention , seems bit old. create bump object using static function: [bumpclient sharedclient], calls connect you. trying play having problems bump detected can send data. using ipod , bu.mp website test code.
Comments
Post a Comment