Articles Tagged 'NSURLConnection'

Very short snippet: NSConnection POST with parameters

che in modalità POST . The object NSMutableURLRequest can be used in either GET mode in POST . . The parameters, however, must be formatted as if they were in GET , ie in the sequence nome_campo1=valore1&nome_campo2=valore2&... . Here's a useful snippet to simplify the construction of fields:

Continued ...

NSURLConnection: Example of use

NSURLConnection allows for controlled from a connection to a remote server. To use it simply:

1
2
3
4
5
6
7
8
9
10
11
/ / The objects sufficient to perform a NSURLConnection
urlConnection; NSURLConnection * URLConnection;
mutableData; NSMutableData mutableData *;

/ / ...

urlString = @ "http://www.miodominio.com/documento.txt" ; NSString * urlString @ = "http://www.miodominio.com/documento.txt";

urlRequest = [ NSURLRequest requestWithURL : [ NSURL URLWithString : urlString ] ] ; NSURLRequest URLRequest = * [ NSURLRequest requestWithURL: [ NSURL URLWithString: urlString]];
/ / The delegate will respond to the states of the connection
NSURLConnection alloc ] initWithRequest : urlRequest delegate : self ] ; URLConnection = [[ NSURLConnection alloc] initWithRequest: URLRequest delegate: self];

Here are delegate methods to check the status of the connection:

[Cc_objc]

Continued ...

Very short snippet: streaming mp3 files on the Apple iPhone

An alternative very simple to run a stream a mp3 file on the Apple iPhone could be:

Continued ...