Skip to content

Instantly share code, notes, and snippets.

@masbog
Last active December 23, 2015 13:09
Show Gist options
  • Select an option

  • Save masbog/6640119 to your computer and use it in GitHub Desktop.

Select an option

Save masbog/6640119 to your computer and use it in GitHub Desktop.
AuthBasic For HTTP streaming .m3u8 with passworded iPCam iOS
NSURLCredential *credential = [[[NSURLCredential alloc]
initWithUser:@"masbog"
password:@"gobmas"
persistence: NSURLCredentialPersistenceForSession] autorelease];
NSURLProtectionSpace *protectionSpace = [[[NSURLProtectionSpace alloc]
initWithHost: @"180.61.3.1"
port:31608
protocol: @"http"
realm: nil
authenticationMethod: NSURLAuthenticationMethodHTTPBasic] autorelease];
[[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential forProtectionSpace: protectionSpace];
if you using ARC, remove autorelease :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment