1. NSURL的UTF8 编码
NSString *_myRequestString = @"inspector=张飞";
NSString *myRequestString = [[NSString alloc] initWithString:[_myRequestString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
2. 同步取网络数据
NSString *_myRequestString = @"inspector=张飞";
NSString *myRequestString = [[NSString alloc] initWithString:[_myRequestString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSData *myRequestData = [ NSData dataWithBytes: [ myRequestString UTF8String ] length: [ myRequestString length ] ];
NSMutableURLRequest *request = [ [ NSMutableURLRequest alloc ] initWithURL: [ NSURL URLWithString: @"http://127.0.0.1:3000/map/get_task_json" ] ];
[ request setHTTPMethod: @"POST" ];
[ request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
[ request setHTTPBody: myRequestData ];
NSURLResponse *response;
NSError *err;
NSData *returnData = [ NSURLConnection sendSynchronousRequest: request returningResponse:&response error:&err];
NSString *content = [NSString stringWithUTF8String:[returnData bytes]];
NSLog(@"responseData: %@", content);
分享到:
相关推荐
Incredible iPhone Apps For Dummies,英文版本,PDF 格式,大小 13 Mb,作者 Bob LeVitus,2010 年 2 月出版。 A full-color directory of must-have iPhone and iPod touch apps! The App Store allows you to ...
标题指出,文档内容涵盖的是iOS(包括iPhone和iPad)平台上的应用开发中关于调试技巧(Debugging Tips)、搜索功能实现(Searching)、通知系统(Notifications)以及键值编码和观察(Key-Value Coding and ...
Tips on rapid game development with C on iPhone How to increase your market by developing games that run on iPhone, Mac OS X, Linux, and Windows How to create multiplayer iPhone games Who is this ...
More iPhone 3 Development Tackling ...Tips on working with data from the web Who this book is for All iPhone and iPod Touch developers, especially developers already familiar with early iPhone SDKs
* Tips on rapid game development with C on iPhone * How to increase your market by developing games that run on iPhone, Mac OS X, Linux, and Windows * How to create multiplayer iPhone games Who is...
Follow step-by-step tutorials, then apply practical tips on signing and selling your applications. Even if you’re new to iPhone development you’ll soon be cranking out great code. Walk through ...
- **Security Best Practices**: Tips for securing sensitive data on the iPhone, including encryption, passcode settings, and remote wipe capabilities. These measures are crucial for maintaining ...
It's got a clever name—Finger Tips—but to learn your way around, you're expected to use an electronic PDF document. This PDF covers the basics well, but it's largely free of details, hacks, ...
More than just tips and pointers, you’ll learn from the authors’ hands-on experiences, including: Dave Barnard of App Cubby on how to use Apple’s User Interface conventions and test for usability ...
Tips for handling touch interactions and capturing JavaScript events Specific CSS styles that are useful for developing applications Techniques for integrating applications with core iPhone services ...
Follow step-by-step tutorials, then apply practical tips on signing and selling your applications. Even if you’re new to iPhone development you’ll soon be cranking out great code. alk through ...
Tips on working with data from the web and the cloud, including Apple's iCloud Who this book is for This book is a continuation of Beginning iPhone Development with Swift. So, this book is for readers...
- **John Muchow(创始人,iPhone Developer Tips.com;首席技术官,3Sixty Software)**:高度推荐本书作为学习 iPhone 开发的坚实基础。 #### 四、总结 《iPhone SDK 开发:构建 iPhone 应用程序》不仅是一本...
•Full of useful tips and techniques to help you become an iOS pro What You’ll Learn •Everything you need to know to develop your own best-selling iPhone and iPad apps •Best practices for ...
The book provides tips and tricks for using C efficiently on the platform. Topics include code organization, memory management, and best practices for creating modular and maintainable code. These ...
As you move from beginning to advanced, you’ll encounter general game programming wisdom, tips for performance improvement, as well as pointers to alternative implementations and further reading. ...