• 2013-05-04
    2006
    Apple开发
    字符串编码:-(NSString*)urlEncode:(NSString*)oldString{CFStringRefescaped=CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,(__bridgeCFStringRef)oldString,NULL,(CFStringRef)@"!*'();:@&=+$,/?%#[]",kCFStringEncodingUTF8);return[NSStringstringWithFormat:@"%@",escaped];}字符串解码:-(NSString*)urlDecode:(NSString*)oldString{NSMutableString*unescaped=[NSMutableStringstringWith
  • 2013-05-04
    1701
    Apple开发
    在苹果Apple/iOS中的MD5加密方法,输出后为大写字母。这种方法产生的加密结果与C#等语言产生的结果是一致的。#import <commoncrypto CommonDigest.h>;- (NSString*)MD5:(NSString*)str{const char *cStr = [str UTF8String];unsigned char result[32];CC_MD5(cStr, strlen(cStr), result);return [NSString stringWithFormat:@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", result[0], result[1], result[2], result[3], result[4], re
  • 2013-05-04
    1008
    Apple开发
    以下实例通过POST方法提交数据并返回结果@try {NSError *error;NSURL *url = [NSURL URLWithString:@http://www.corp.com/info.aspx];NSMutableDictionary *dic =" [[NSMutableDictionary" alloc] init]; [dic setValue:@"14" forKey:@"type"];[dic setValue:@"POST" forKey:@"method"];[dic setValue:@"1" forKey:@"siteid"]; NSString *myBounds = [[NSString alloc] init
  • 2013-05-04
    1105
    Apple开发
    不管是在windows、unix或apple环境中进行程序开发,xml文件的存取总是少了的。这里介绍一种在apple环境中使用NSXMLDocument读取远程xml文件的方法。文件读取代码:NSError *error;NSURL *url = [NSURL URLWithString:@"http://www.corp.com/info.xml"];NSString *returnValue = @"";@try {NSXMLDocument *doc = [[NSXMLDocument alloc] initWithContentsOfURL:url options:0 error:&error];NSArray *arrs = [doc nodesForXPath:@"/root/message" error:&a
  • Copyright © 2021 技术探索 All Rights Reserved.