ios7 - iOS 7 Multipeer Connectivity -


i'm making ios 7 app multipeer connectivity framework, unable 2 devices recognize each other. i've looked through documentation , wwdc video, , information on framework limited besides that. have experience working new peer-to-peer capability , can help?

here's have far. browservc presented on screen no devices found when i'm running app on 2 devices.

mcpeerid *peer = [[mcpeerid alloc] initwithdisplayname:@"user"];   _session =  [[mcsession alloc] initwithpeer:peer];   nsstring *service = @"nsync";    _session.delegate = self;    mcadvertiserassistant *assistant =[[mcadvertiserassistant alloc] initwithservicetype:service                                                                          discoveryinfo:nil                                                                                session:_session];   [assistant start];     mcbrowserviewcontroller *browservc = [[mcbrowserviewcontroller alloc] initwithservicetype:service                                                                                     session:_session];   browservc.delegate = self;   [self presentviewcontroller:browservc                      animated:yes                    completion:nil]; 

to allow browser see devices, you'll need have other devices advertising. think problem mcadvertiserassistant going out of scope , being deallocated, it's stored in local variable.

here code i've used advertise:

#define service_type @"myservicetype" ...  @property (nonatomic, strong) mcadvertiserassistant* advertiserassistant; ...  self.peerid = [[mcpeerid alloc] initwithdisplayname:[[uidevice currentdevice] name]]; self.advertisersession = [[mcsession alloc] initwithpeer:self.peerid]; self.advertisersession.delegate = self; self.advertiserassistant = [[mcadvertiserassistant alloc] initwithservicetype:service_type discoveryinfo:nil session:self.advertisersession]; [self.advertiserassistant start]; 

note i'm storing advertiser assistant in property, not deallocated method creates finishes.

and browse:

self.peerid = [[mcpeerid alloc] initwithdisplayname:[[uidevice currentdevice] name]]; self.browsersession = [[mcsession alloc] initwithpeer:self.peerid]; self.browsersession.delegate = self; self.browser = [[mcbrowserviewcontroller alloc] initwithservicetype:service_type session:self.browsersession]; self.browser.delegate = self; [self presentviewcontroller:self.browser animated:yes completion:nil]; 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -