Skip to content
This repository has been archived by the owner on Jun 2, 2018. It is now read-only.

UITextField #161

Closed
wants to merge 39 commits into from
Closed

UITextField #161

wants to merge 39 commits into from

Conversation

segiddins
Copy link
Contributor

Adds Support for the UITextField delegate protocol

a2 and others added 30 commits June 26, 2013 13:24
…icksend-master

Conflicts:
	BlocksKit/MessageUI/MFMessageComposeViewController+BlocksKit.m
Closes BlocksKit#134, probably not in a way that is satisfactory to @seivan. ;-)
@a2
Copy link
Collaborator

a2 commented Jul 26, 2013

Re-create the pull request so it merges into next instead of master.

@a2 a2 closed this Jul 26, 2013
@@ -56,19 +56,19 @@
in an instance of NSURLConnection. It only works on block-backed
NSURLConnection instances.
*/
@property (nonatomic, weak) id delegate;
@property (nonatomic, weak, setter = bk_setDelegate:) id bk_delegate;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I do connection.bk_delegate = self; I'm getting "[NSURLConnection bk_setDelegate:]: unrecognized selector sent to instance" error

@segiddins
Copy link
Contributor Author

@IlyaBokovenko this PR was closed six months ago and not merged.

@IlyaBokovenko
Copy link

Oops, haven't notice that :-( However if you try to install last version of
BlocksKit from CocoaPods, you'll probably get the same error: trying to set
connection.bk_delegate produces "unrecognized selector" error at runtime.
I've patched +[NSURLConnection(BlocksKit) load] method like this:

-[self bk_registerDynamicDelegate];
+[self bk_registerDynamicDelegateNamed:@"bk_delegate"];

It is fixed the issue )

On 11 January 2014 18:35, Samuel E. Giddins [email protected]:

@IlyaBokovenko https://github.com/IlyaBokovenko this PR was closed six
months ago and not merged.

Reply to this email directly or view it on GitHubhttps://github.com/pandamonia/BlocksKit/pull/161#issuecomment-32097510
.

ó Õ×ÁÖÅÎÉÅÍ, éÌØÑ

@li1215392
Copy link

I am trying to implement socket like this :(in fact,I'm creating a SSl-Pro based communication with a VPN server)

CFReadStreamRef readStream;

 CFWriteStreamRef writeStream;

 CFStreamCreatePairWithSocketToHost(NULL,

                                    (CFStringRef)@"192.168.2.200",

                                    443,

                                    &readStream,

                                    &writeStream);



 [(id)cfis setProperty:NSStreamSocketSecurityLevelSSLv3 forKey:NSStreamSocketSecurityLevelKey];

 [(id)cfos setProperty:NSStreamSocketSecurityLevelSSLv3 forKey:NSStreamSocketSecurityLevelKey];



 NSDictionary *sslSettings = [NSMutableDictionary dictionaryWithObjectsAndKeys:(id)kCFBooleanFalse,kCFStreamSSLValidatesCertificateChain,kCFBooleanFalse,kCFStreamSSLIsServer,nil];



 CFReadStreamSetProperty(readStream,kCFStreamPropertySSLSettings,sslSettings);



 is = (NSInputStream *)readStream;

 os = (NSOutputStream *)writeStream;



 [is setDelegate:self];

 [os setDelegate:self];



 [is scheduleInRunLoop:[NSRunLoop currentRunLoop]

                             forMode:NSDefaultRunLoopMode];

 [os scheduleInRunLoop:[NSRunLoop currentRunLoop]

                              forMode:NSDefaultRunLoopMode];



 [is open];

 [os open];





 CFReadStreamOpen(readStream);

 CFWriteStreamOpen(writeStream);



 char t1 = 0x58;

 NSInteger i = [os write:(const uint8_t *)&t1 maxLength:1]; 

 assert(sizeof(int) == 4);

 NSLog(@"write type :%ld",i);



 const char *sessionid = [_strSessionId UTF8String];//直接从XML拷贝过来的



 int nSessionid = htonl(strlen(sessionid));

 i = [os write:(const uint8_t *)(char *)&nSessionid maxLength:4];

 NSLog(@"write session id 的 BASE64 编码长度:%ld",i);



 i = [os write:(const uint8_t *)sessionid maxLength:strlen(sessionid)];

 NSLog(@"session id 的 BASE64 编码:%ld",i);



 char cTcp = ('0' == '0')? 0x00:0x01;//确定是tcp

 i = [os write:(const uint8_t *)&cTcp maxLength:1];

 NSLog(@"write IS_TCP:%ld",i);

 char ok = '0';

 NSInteger j = [is read:(uint8_t *)&ok maxLength:1];

 if (ok != 0x00 ) {

      NSLog(@"连接服务器未成功:%ld %c",j,ok);

      return;

 }

 NSLog(@"连接服务器成功:%c",ok);




 //使用NSOutputStream对象向服务器发送数据,

 char dynamic = 0x00;

 i = [os write:(const uint8_t *)&dynamic maxLength:1];

 NSLog(@"is_dynamic_port %ld",i);

 [os write:(const uint8_t *)&dynamic maxLength:1];

 NSLog(@"is_compress %ld %d",i,[os  hasSpaceAvailable]);

 int appadr = htonl(StrLength(@"192.168.1.54"));

 i = [os write:(const uint8_t *)(char *)&appadr maxLength:4];

 NSLog(@"服务地址长度 %ld hasSpaceAvailable:%d",i,[os  hasSpaceAvailable]);

 i = [os write:(const uint8_t *)[@"192.168.1.54" UTF8String] maxLength:strlen([@"192.168.1.54" UTF8String])];

 NSLog(@"服务器地址 %ld",i);

 int apport = htonl(33889);

 i = [os write:(const uint8_t *)(char *)&apport maxLength:4];

 NSLog(@"服务提供的端口 %ld",i );

 int mapid = htonl(strlen([_mapID UTF8String]));

 i = [os write:(const uint8_t *)(char *)&mapid maxLength:4];

 NSLog(@"mapid  长度:%ld",i );

 i = [os write:(const uint8_t *)[_mapID UTF8String] maxLength:strlen([_mapID UTF8String])];

 NSLog(@"mapid %ld",i );

why I execute i = [os write:(const uint8_t *)[@"192.168.1.54" UTF8String] maxLength:strlen([@"192.168.1.54" UTF8String])]; i is always -1? What am I doing wrong?

Thank you for your replying!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants