Created
November 6, 2012 16:10
-
-
Save dalexsoto/4025715 to your computer and use it in GitHub Desktop.
add a host to the undocumented static trustedHosts property on NSURLConnection to ignore SSL validation failures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add a host to the undocumented static trustedHosts property on NSURLConnection to ignore SSL validation failures | |
public class NSUrlExtensions | |
{ | |
public static void AddTrustedHost (string trustedHost) | |
{ | |
IntPtr classPtr_NSURLConnection = Class.GetHandle("NSURLConnection"); | |
IntPtr sel_trustedHosts = Selector.GetHandle("trustedHosts"); | |
IntPtr p = Messaging.IntPtr_objc_msgSend(classPtr_NSURLConnection, sel_trustedHosts); | |
NSMutableArray array = new NSMutableArray(p); | |
array.Add (new NSString(trustedHost)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment