Convert C# class to iPhone Objective C class
$5-10 USD
Pagado a la entrega
Convert a C# class (see details) to an iPhone objective C class.
Please stay as close to this C# class as possible, including using Dictionary.
Here is the C# usage of the class. I need an iPhone/Objective C class (NSObject class) which can be used similar to this:
C# usage:
CommDB db = new CommDB();
[url removed, login to view] ="someCommand";
[url removed, login to view]("key","value");
[url removed, login to view]("key2", "value2");
string response = [url removed, login to view]();
## Deliverables
See the attached file for a better view of the C# class. class CommDB //database communication object { //public properties public string cmd { get; set; } public Dictionary d { get; set; } //this could be added as a variable for play on a different server private const string url = "[url removed, login to view]"; public CommDB() { d = new Dictionary(); } public string SendPost() { string post = "cmd=" + cmd; //add all name value pairs to post string foreach (KeyValuePair dictionary in d) { post += "&" + [url removed, login to view] + "=" + [url removed, login to view]; } string response = null; try { //Our postvars byte[] buffer = [url removed, login to view](post); //debug //[url removed, login to view]("POST: {0}", post); //Initialisation, we use localhost, change if appliable HttpWebRequest WebReq = (HttpWebRequest)[url removed, login to view](url); //Our method is post, otherwise the buffer (postvars) would be useless [url removed, login to view] = "POST"; //We use form contentType, for the postvars. [url removed, login to view] = "application/x-www-form-urlencoded"; //The length of the buffer (postvars) is used as contentlength. [url removed, login to view] = [url removed, login to view]; //We open a stream for writing the postvars Stream PostData = [url removed, login to view](); //Now we write, and afterwards, we close. Closing is always important! [url removed, login to view](buffer, 0, [url removed, login to view]); [url removed, login to view](); //Get the response handle, we have no true response yet! HttpWebResponse WebResp = (HttpWebResponse)[url removed, login to view](); //Let's show some information about the response //[url removed, login to view]([url removed, login to view]); //[url removed, login to view]([url removed, login to view]); //Now, we read the response (the string), and output it. Stream Answer = [url removed, login to view](); StreamReader _Answer = new StreamReader(Answer); response = [url removed, login to view](); } catch (Exception ex) { [url removed, login to view]([url removed, login to view]); } return [url removed, login to view](); } }
Nº del proyecto: #3722322