- Home /
Question by
Bruno Gonalves · Apr 28, 2010 at 07:41 PM ·
iphonesettingsproxy
How to access iPhone Settings to make use of proxy configurations?
Hi all,
I'm trying send POST info to a http, but I noticed that it doesn't really work when internet conectivity is behind a proxy.
My question is, how can I send to unity the proxy settings used on iPhone for Internet access so I can use the system default adress, port, user and password?
Thanks in advance
Comment
Answer by franky303 · Oct 02, 2013 at 07:33 AM
the only thing i could find is to use native objective-C code (in a native plugin) to obtain proxy settings:
std::string getProxyName()
{
CFDictionaryRef dicRef = CFNetworkCopySystemProxySettings();
const CFStringRef proxyCFstr = (const CFStringRef)CFDictionaryGetValue(dicRef, (const void*)kCFNetworkProxiesHTTPProxy);
char buffer[4096];
memset(buffer, 0, 4096);
if (CFStringGetCString(proxyCFstr, buffer, 4096, kCFStringEncodingUTF8))
{
return std::string(buffer);
}
return "";
}
int CDownloadThread::getProxyPort()
{
CFDictionaryRef dicRef = CFNetworkCopySystemProxySettings();
const CFNumberRef portCFnum = (const CFNumberRef)CFDictionaryGetValue(dicRef, (const void*)kCFNetworkProxiesHTTPPort);
SInt32 port;
if (CFNumberGetValue(portCFnum, kCFNumberSInt32Type, &port))
{
return port;
}
return -1;
}
Your answer
Follow this Question
Related Questions
Specify iphone project 1 Answer
unity2020 iphone X and later cut off screen , 0 Answers
Unity 5.1.1P3 , append not available. 0 Answers
Puzzle Game 2.5D intended for iPhone/iPad - Any particular camera settings recommended? 2 Answers
iphone 2D settings 2 Answers