Basic knowledge of IOS development-fragment 51 and basic knowledge of ios-51
1. Disable certificate and domain name verification over https.
AFSecurityPolicy *securityPolicy = [AFSecurityPolicy defaultPolicy]; securityPolicy.allowInvalidCertificates = YES; securityPolicy.validatesDomainName = NO; _manager.securityPolicy = securityPolicy;
If In order to validate a domain name for self signed certificates is reported, you MUST use pinning also solves this problem.
2: How does iOS UIWebView access https to bypass certificate verification?
@implementation NSURLRequest (NSURLRequestWithIgnoreSSL)+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host{ return YES;}@end
3: SDWebImage loading image bypassing Certificate
[myImageView sd_setImageWithURL:[NSURL URLWithString:replyModel.reply_name] placeholderImage:[UIImage imageNamed:@"default_header"] options:SDWebImageAllowInvalidSSLCertificates]
4: some good articles about Https
http://oncenote.com/2014/10/21/Security-1-HTTPS/http://www.jianshu.com/p/2d72ef8dbf5ahttp://www.jianshu.com/p/b03ae4a1a2d3https://github.com/cos6meteors/YMHttpsTest
5: forcibly remove HTML Tag text
+ (NSString *)getStandarString:(NSString *)str{ NSArray *components = [str componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]]; NSMutableArray *componentsToKeep = [NSMutableArray array]; for (int i = 0; i < [components count]; i = i + 2) { NSString *str = [components objectAtIndex:i]; if (str.length) { [componentsToKeep addObject:[components objectAtIndex:i]]; } } NSString *plainText = [componentsToKeep componentsJoinedByString:@"\n"]; plainText = [[[plainText description]stringByReplacingOccurrencesOfString:@" " withString:@""]stringByReplacingOccurrencesOfString:@" " withString:@""]; return plainText; }
6: A third-party keyboard after ios8. the height is 0.
After IOS8.0, you can install a third-party keyboard, such as sogou input method.
The obtained height is 0. this is because the keyboard pop-up method:-(void) keyBoardWillShow :( NSNotification *) notification needs to be executed three times. If you print it, you will find that the keyboard height is: first time: 0; second time: 216: Third time: 282. it is not the third time that the real height is obtained.
It can be implemented in the notification of UIKeyboardDidChangeFrameNotification. Note that this method is executed three times in the pop-up keyboard and needs to be processed to achieve the desired effect.
Register a keyboard event:
[[Nsicationcenter center defacenter center] addObserver: self selector: @ selector (keyBoardChange :) name: UIKeyboardDidChangeFrameNotification object: nil];
Pragma mark-trigger of keyboard change event
(void)keyBoardChange:(NSNotification *)notification{NSDictionary *dict = notification.userInfo; NSValue *aValue = [dict objectForKey:UIKeyboardFrameEndUserInfoKey]; NSNumber *animationTime = [dict objectForKey:@”UIKeyboardAnimationDurationUserInfoKey”];CGRect keyboardRect = [aValue CGRectValue]; CGFloat keyHeight = (HEIGHT(self.view)-Y(searBar)-HEIGHT(searBar))-keyboardRect.size.height; if(keyHeight<=0){ [UIView animateWithDuration:[animationTime doubleValue] animations:^{ self.view.frame =CGRectMake(0, keyHeight, WIDTH(self.view), HEIGHT(self.view)); } completion:^(BOOL finished) { }]; }}
Pragma mark-keyboard hide event
(void)keyBoardDidHide:(NSNotification *)notification{ self.view.frame = CGRectMake(0, 0, WIDTH(self.view), HEIGHT(self.view)); }
There is another code:
-(Void) keyboardWillShow :( NSNotification *) notification {CGFloat curkeyBoardHeight = [[[notification userInfo] objectForKey: @ "UIKeyboardBoundsUserInfoKey"] CGRectValue]. size. height; CGRect begin = [[[notification userInfo] objectForKey: @ "UIKeyboardFrameBeginUserInfoKey"] CGRectValue]; CGRect end = [[notification userInfo] objectForKey: @ "UIKeyboardFrameEndUserInfoKey"] CGRectValue]; // The third-party keyboard callback occurs three times. The listener only executes the last if (begin. size. height> 0 & (begin. origin. y-end.origin.y> 0) {keyBoardHeight = curkeyBoardHeight; [self showKeyboard: notification];}