* Fixed #9: compilation error with iPhone 3.0 SDK.
* MYBonjourRegistration now allows you to set a TXT dictionary with non-NSData key values; they'll be translated to UTF-8 object descriptions. Useful for NSStrings and NSNumbers.
1.1 --- a/Bonjour/MYBonjourRegistration.m Sun May 10 19:05:52 2009 -0700
1.2 +++ b/Bonjour/MYBonjourRegistration.m Sat May 16 14:10:15 2009 -0700
1.3 @@ -148,10 +148,24 @@
1.4 }
1.5
1.6
1.7 ++ (NSData*) dataFromTXTRecordDictionary: (NSDictionary*)txtDict {
1.8 + // First translate any non-NSData values into UTF-8 formatted description data:
1.9 + NSMutableDictionary *encodedDict = $mdict();
1.10 + for (NSString *key in txtDict) {
1.11 + id value = [txtDict objectForKey: key];
1.12 + if (![value isKindOfClass: [NSData class]]) {
1.13 + value = [[value description] dataUsingEncoding: NSUTF8StringEncoding];
1.14 + }
1.15 + [encodedDict setObject: value forKey: key];
1.16 + }
1.17 + return [NSNetService dataFromTXTRecordDictionary: encodedDict];
1.18 +}
1.19 +
1.20 +
1.21 - (void) updateTxtRecord {
1.22 [NSObject cancelPreviousPerformRequestsWithTarget: self selector: @selector(updateTxtRecord) object: nil];
1.23 if (self.serviceRef) {
1.24 - NSData *data = [NSNetService dataFromTXTRecordDictionary: _txtRecord];
1.25 + NSData *data = [[self class] dataFromTXTRecordDictionary: _txtRecord];
1.26 Assert(data!=nil, @"Can't convert dictionary to TXT record");
1.27 DNSServiceErrorType err = DNSServiceUpdateRecord(self.serviceRef,
1.28 NULL,
2.1 --- a/MYNetwork-iPhone.xcodeproj/project.pbxproj Sun May 10 19:05:52 2009 -0700
2.2 +++ b/MYNetwork-iPhone.xcodeproj/project.pbxproj Sat May 16 14:10:15 2009 -0700
2.3 @@ -218,8 +218,8 @@
2.4 isa = PBXGroup;
2.5 children = (
2.6 27D915B90FA8EA85002B0DEC /* Addressing */,
2.7 + 278C1B2A0F9F865800954AE1 /* PortMapper */,
2.8 27D915BA0FA8EA98002B0DEC /* Bonjour */,
2.9 - 278C1B2A0F9F865800954AE1 /* PortMapper */,
2.10 270E9AA30EE61113003F17CA /* TCP */,
2.11 270E9AAF0EE61113003F17CA /* BLIP */,
2.12 );
3.1 --- a/TCP/TCPConnection.m Sun May 10 19:05:52 2009 -0700
3.2 +++ b/TCP/TCPConnection.m Sat May 16 14:10:15 2009 -0700
3.3 @@ -150,9 +150,11 @@
3.4 }
3.5
3.6
3.7 -@synthesize address=_address, isIncoming=_isIncoming, status=_status, delegate=_delegate,
3.8 +@synthesize address=_address, isIncoming=_isIncoming, status=_status,
3.9 reader=_reader, writer=_writer, server=_server, openTimeout=_openTimeout;
3.10
3.11 +- (id<TCPConnectionDelegate>) delegate {return _delegate;}
3.12 +- (void) setDelegate: (id<TCPConnectionDelegate>) delegate {_delegate = delegate;}
3.13
3.14 - (NSError*) error
3.15 {
4.1 --- a/TCP/TCPListener.m Sun May 10 19:05:52 2009 -0700
4.2 +++ b/TCP/TCPListener.m Sat May 16 14:10:15 2009 -0700
4.3 @@ -52,13 +52,17 @@
4.4 }
4.5
4.6
4.7 -@synthesize delegate=_delegate, port=_port, useIPv6=_useIPv6,
4.8 +@synthesize port=_port, useIPv6=_useIPv6,
4.9 bonjourServiceType=_bonjourServiceType, bonjourServiceOptions=_bonjourServiceOptions,
4.10 bonjourPublished=_bonjourPublished, bonjourError=_bonjourError,
4.11 bonjourService=_netService,
4.12 pickAvailablePort=_pickAvailablePort;
4.13
4.14
4.15 +- (id<TCPListenerDelegate>) delegate {return _delegate;}
4.16 +- (void) setDelegate: (id<TCPListenerDelegate>) delegate {_delegate = delegate;}
4.17 +
4.18 +
4.19 - (NSString*) description
4.20 {
4.21 return $sprintf(@"%@[port %hu]",self.class,_port);