編輯:感謝您解決我的答案,Verizon網絡優化有一些圖像壓縮機制。
我想,在字節流的術語中,圖像的質量取決於服務器是否提供壓縮。
但有一些解決方案。您還可以使用線程編程實現NSURLConnectionDataDelegate
以處理來自URL請求的數據。有有趣的方法:
/** connection:didReceiveResponse: is called when
* enough data has been read to construct an
* NSURLResponse object. In the event of a protocol
* which may return multiple responses (such as HTTP
* multipart/x-mixed-replace) the delegate should be
* prepared to inspect the new response and make
* itself ready for data callbacks as appropriate.
**/
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response;
/** connection:didReceiveData: is called with a single
* immutable NSData object to the delegate,
* representing the next portion of the data loaded
* from the connection. This is the only guaranteed
* for the delegate to receive the data from the
* resource load
**/
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
/** connection:willCacheResponse: gives the delegate
* an opportunity to inspect and modify the
* NSCachedURLResponse which will be cached by the
* loader if caching is enabled for the original
* NSURLRequest. Returning nil from this delegate
* will prevent the resource from being cached. Note
* that the -data method of the cached response may
* return an autoreleased in-memory copy of the true
* data, and should not be used as an alternative to
* receiving and accumulating the data through
* connection:didReceiveData
**/
- (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse;
/** connectionDidFinishLoading: is called when all
* connection processing has completed successfully,
* before the delegate is released by the
* connection
**/
- (void)connectionDidFinishLoading:(NSURLConnection *)connection;
您還可以累加管理didReceiveData
數據每個傳入數據,並在完成下載,在connectionDidFinishLoading
,您可以處理圖像的接收到的所有的NSData
。
希望它可以幫助你。
謝謝鄧肯。我從靜態URL下載JPEG圖像,我認爲這很難被認爲是「服務」。也許有些第三方應用程序造成這種情況?奇怪... – Stavash