开发者

for each publish,how can i make my device name as unique?

开发者 https://www.devze.com 2023-03-09 05:16 出处:网络
i am publishing my netService object once with same domain and name. another device finding my service as myService .

i am publishing my netService object once with same domain and name. another device finding my service as myService .

but again i publishing my netService object again with same domain and name .another device will detect my devise as myService(1).

code:

self.netService = [[NSNetService alloc] initWithDomain:domain type:protocol name:name port:self.port];
if(self.netService == nil)
    return NO;

[self.netService scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
****[self.netService publish];****
[self.netService set开发者_如何学CDelegate:self];

for each publish,how can i make my device name as unique?


You can use unique Device Id for this:

NSString* deviceID = [ UIDevice currentDevice ].uniqueIdentifier;
0

精彩评论

暂无评论...
验证码 换一张
取 消