2011-03-22 9 views
6

का उपयोग कर याहू होस्टेड साइट से सुरक्षित यूआरएल संरक्षित यूआरएल MPMoviePlayerViewController दस्तावेज में उल्लिखित समान कोड का उपयोग कर रहा हूं। लेकिन यह काम नहीं कर रहा है। यह कहता है "आप अधिकृत नहीं हैं .."। मेरा सर्वर याहू पर होस्ट किया गया है। यूआरएल की तरह this.MPMoviePlayerViewController setDefaultCredential

कोड कुछ नीचे

NSURLCredential *credential = [[NSURLCredential alloc] 
          initWithUser:@"abc" 
          password:@"xyz" 
          persistence: NSURLCredentialPersistencePermanent]; 

NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc] 
            initWithHost:@"www.someurl.com" 
            port:80 
            protocol:@"http" 
            realm:@"tmp" 

    authenticationMethod:NSURLAuthenticationMethodDefault]; 

[[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential 
               forProtectionSpace:protectionSpace]; 

[protectionSpace release]; 
[credential release]; 
    MPMoviePlayerViewController *movie = [[[MPMoviePlayerViewController alloc] initWithContentURL:url] autorelease]; 

उत्तर

1

है यदि यह आपको पहले एक NSURLConnection को खोलने और फिर प्रासंगिक प्रतिनिधि तरीकों में क्रेडेंशियल पारित एक बार आप एक प्रतिक्रिया मिल जाएगा UIWebView पहुंच रूप में ही है आप कनेक्शन रद्द कर देते हैं और फिर MPMoviePlayerViewController कनेक्शन के साथ शुरू करते हैं।

संबंधित मुद्दे