Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-20-2009, 07:03 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 3
Question HTTP Basic Authentication request on UIWebView

I am trying to access a secure website through UIWebView. When I access it through safari, i get an authentication challenge but the same does not appear in my UIWebView in the application. How can I make it appear?

Any pointers, sample code or links will be very helpful. Thanks a lot.
ujjwalt is offline   Reply With Quote
Old 01-28-2010, 08:31 AM   #2 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 1
Cool

Hi,

i was fighting with same idea today.

in your Controller.h file implement this at the end (after @end):

Code:
@interface NSURLRequest (DummyInterface)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString*)host;
+ (void)setAllowsAnyHTTPSCertificate:(BOOL)allow forHost:(NSString*)host;
@end
and in your Controller.m file add this line between creating "url" request and calling webview for displaying:

Code:
[NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[url host]];

it will automaticly accept any certificate from "url" host. I think you already figured out, but i though that someone else will may found thise usefull.. have fun guys
iluz is offline   Reply With Quote
Old 01-28-2010, 09:33 AM   #3 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 3
Smile Thanks

Quote:
Originally Posted by iluz View Post
I think you already figured out, but i though that someone else will may found thise usefull.. have fun guys
Thanks for I hadn't figured it out. I had been using a view with username and password fields instead of original auth challenge. I'd try to use this now. Thanks a lot.


Cheers,
Ujjwal
UVTimes
ujjwalt is offline   Reply With Quote
Old 02-14-2010, 04:59 PM   #4 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 12
Default

Quote:
Originally Posted by ujjwalt View Post
Thanks for I hadn't figured it out. I had been using a view with username and password fields instead of original auth challenge. I'd try to use this now. Thanks a lot.


Cheers,
Ujjwal
UVTimes
Sorry for jumping in, but I believe this is an unsupported API? Anyone ever had their app approved with this bit of code?

Thanks!
mschwade is offline   Reply With Quote
Old 02-28-2010, 07:11 AM   #5 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 65
Default

Quote:
Originally Posted by mschwade View Post
Sorry for jumping in, but I believe this is an unsupported API? Anyone ever had their app approved with this bit of code?

Thanks!

I tried the code above but does not work. I have already @implementation in my .m file. Should I add the another implementation like @implement NSURLRequest? I tried placing it but I got more errors.

I have an error "NSString may not respond to -host

I need help on this. Thanks in advance.
felixtgomezjr is offline   Reply With Quote
Old 11-25-2010, 06:33 AM   #6 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 3
Default SOLVED - U have a solution for this

[SOLVED] OK i have a perfect solution on this address: Delphi Warrior: Products for Cocoa (tm) and iOS (tm)

The provided professinal demo project can handle authentication and also a file downloads. There is NO undocumented API calls so it can be used in AppStore without any problems ...
And it can intercept download of ALL files included in an html document like images, css, javascript etc. And it is freeware ...

Mail me at kirila@abv.bg if somebody finds bugs or have additional wishes.
Sevast is offline   Reply With Quote
Old 11-25-2010, 06:35 AM   #7 (permalink)
Dr. Touch Cocoa Helpdesk
iPhone Dev SDK Supporter
 
Join Date: Sep 2008
Location: Vienna, Austria
Posts: 537
Send a message via AIM to Oliver Drobnik Send a message via MSN to Oliver Drobnik Send a message via Skype™ to Oliver Drobnik
Default

Note that usage of these private methods will get your app rejected.
__________________
regards

Oliver Drobnik
Cocoanetics - Our DNA is programmed in Objective-C.

Linguan – makes localizing strings file fun!

Cocoanetics Parts Store – easy to use yet professionally looking components that you can use to spruce up your own apps. Augmented Reality, Calendar Control, Pin Lock or Purchase Button are only some examples. You get full source code, no static library crap, and lifetime support. Check it out today!
Oliver Drobnik is offline   Reply With Quote
Reply

Bookmarks

Tags
authentication, http, uiwebview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 271
20 members and 251 guests
ADY, AragornSG, Bertrand21, Dani77, Dattee, fkmtc, HDshot, HemiMG, iDifferent, JasonR, macquitzon216, mer10, prchn4christ, Rudy, sacha1996, sneaky, spiderguy84, Sunny46, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:10 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0