TAILIEUCHUNG - Phát triển ứng dụng cho iPhone và iPad - part 36

Tham khảo tài liệu 'phát triển ứng dụng cho iphone và ipad - part 36', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Example 1 Location-Based Search 319 NSLog connection didReceiveResponse setLength 0 Next you will implement the connection didReceiveData method. The connection calls this method each time it receives a chunk of data so you simply append the received chunk to your responseData buffer Available for download on - void connection NSURLConnection connection didReceiveData NSData data NSLog connection didReceiveData Append the received data to our responseData property appendData data Now you need to implement connectionDidFinishLoading. This method runs when the connection has finished loading all of the requested data. Here you convert the response data to a string clean up the connection and call the method that you will write to parse the XML Available far download on - void connectionDidFinishLoading NSURLConnection connection NSLog connectionDidFinishLoading Convert the data to a NSString responseString NSLog Response String string and log the response string NSString alloc initWithData encoding NSUTF8StringEncoding n responseString responseString release connection release self parseXML Finally you will implement the connection didFailWithError method to log that an error occurred. Remember that you will want to provide some more robust error handling and reporting 320 CHAPTER 11 INTEGRATING WITH WEB SERVICES in a production application. You will also probably want to give the user some feedback as to why the error occurred. Here is the implementation o Available for download on - void connection NSURLConnection connection didFailWithError NSError error NSLog connection didFailWithError NSLog error localizedDescription connection release Note that you don t have to call a web service or a URL asynchronously but it is certainly my recommendation that you do so. .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.