Send POST to browser
___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Send POST data to browser
___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Send POST data to browser
Hi, I'm new in programming for iPhone and I have a problem. I have a website with login form and I want to write a program on iPhone which open this website without authentication. I thought to launch a brwoser from my application and send a POST data with username and password, but I have no idea how to do that. I can launch browser with url using this code: NSURL *url = [NSURL URLWithString: @"https://www.example.com/index.php";]; [[UIApplication sharedApplication] openURL: url]; but I don't know how to send post data. I tried also another solution: send post data from my application to website and then get a response, but then I don't know how to open returned page in browser. I used this code: NSString *postString = [[NSString alloc] initWithFormat:@"username=%@&password=%@", [self urlEncodeValue: username], [self urlEncodeValue: password]]; NSData *requestData = [NSData dataWithBytes: [postString UTF8String] length: [postString length]]; NSURL *url = [NSURL URLWithString: @"https://www.example.com/index.php";]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: url]; [request setHTTPMethod: @"POST"]; [request setValue: @"application/x-www-form-urlencoded" forHTTPHeaderField: @"Content-Type"]; [request setHTTPBody: requestData]; NSURLResponse *response; NSError *error; NSData *returnData = [NSURLConnection sendSynchronousRequest: request returningResponse: &response error: &error]; NSString *dataReturned = [[NSString alloc] initWithData: returnData encoding: NSASCIIStringEncoding]; I will be appreciate of any help. Best regards Bartosz Bialecki Wiedza. Wikipedia. Encyklopedia. Zrozum otaczający Cię świat: http://klik.wp.pl/?adr=http%3A%2F%2Fwikipedia.wp.pl&sid=857 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Running Safari from application
Hi, I try to open local html file in Safari from my application. I use this code: - (void)viewDidLoad { [super viewDidLoad]; username = [[NSUserDefaults standardUserDefaults] stringForKey: @"username"]; password = [[NSUserDefaults standardUserDefaults] stringForKey: @"password"]; if ([username length] == 0 || [password length] == 0) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle: alertTitle message: alertMessage delegate: self cancelButtonTitle: alertCancelButtonTitle otherButtonTitles: nil]; [alert show]; [alert release]; } else { if ([self saveHtmlFile]) [self showPageInSafari]; } } - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { exit(0); } } - (BOOL) saveHtmlFile { NSString *fileContent = [NSString stringWithFormat: @"function send_request() { var form = document.getElementById(\"login\"); form.submit(); }", username, password]; NSError *error; return [fileContent writeToFile: [self getPathToHtmlFile] atomically: YES encoding: NSUnicodeStringEncoding error: &error]; } - (void) showPageInSafari { [[UIApplication sharedApplication] openURL: [NSURL fileURLWithPath: [self getPathToHtmlFile]]]; } - (NSString *) getPathToHtmlFile { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSDocumentDirectory, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; return [NSString stringWithFormat: @"%@/login.html", documentsDirectory]; } The problem is that the safari is not launched. If I put in showPageInSafari function openURL: [NSURL URLWithString: @"http://www.example.com/index.php";] then it works. Do you know what is wrong? Thanks Bartosz Bialecki Znajdź mieszkanie dla siebie! Porównaj i kup. http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fogloszenia_nier.html&sid=862 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
WebView and PickerView problem
Hi, I have small problem. I have WebView in my application and I open website where there are some select elements. When I clicked on select, then PickerView appears. The problem is, when I click Done button in PickerView scrollbar in WebView changes his position. Does anyone know what's going on? Best regards Bartosz Bialecki Dołącz się do Manify! Wyjdźmy na ulice, w WALCE O TAŃSZE PIWO! http://klik.wp.pl/?adr=www.zatanisci.pl&sid=856 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: WebView and PickerView problem
Hi, I'am very new in programming in Cocoa and I have no idea what is this pickerview. I don't create any pickerview myself. This pickerview appears myself when I click a select eleemnt on website. I forgot (maybe this is important information), I'm creating application for iPhone. > > On 22 Sep 2009, at 01:58, Bartosz Białecki wrote: > > > Hi, > > > I have small problem. I have WebView in my application and I open > > > website where there are some select elements. When I clicked on > > > select, > > > then PickerView appears. The problem is, when I click Done button in > > > PickerView scrollbar in WebView changes his position. Does anyone know > > > what's going on? > > > > What is this PickerView you're referring to? The closest matches I can > > find in the documentation are ABPeoplePickerView and > > QCCompositionPickerView, neither of which makes very much sense in > > context. > > > MODA NA SUKCES - zobacz drzewo bohaterów :) > Kliknij: > http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fdrzewo-moda.html&sid=866 MODA NA SUKCES - zobacz drzewo bohaterów :) Kliknij: http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fdrzewo-moda.html&sid=866 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: WebView and PickerView problem
I want to see some control (i.e. PickerView) when I click on the select element. The problem is that after close PickerView (or whatever this is) the scrollbar of webview changes its position (not scrollbar on website). Select element on website has only numbers. > I don't know anything about WebView on the iPhone, but I suspect the > picker view is a standard way of letting you choose from a > element. On the desktop it would be a popup menu, but there is no > popup menu on the iPhone. Why are you surprised that the picker view > appears? What did you expect to see when you tapped the select > element? Didn't you expect there is some way to let you make a > selection? > > As for why the web view changes its position, that depends on the web > page. Can you give us the URL of the web page so we can see for > ourselves? What are the options within the select element? Maybe the > purpose of the select element is to jump to a different location on > the page and it is behaving exactly as designed. Or maybe there is a > bug in WebView that should be reported to Apple. It's impossible to > tell without more information. > > --Andy > > > On Sep 23, 2009, at 5:24 AM, Bartosz Białecki wrote: > > > Hi, > > I'am very new in programming in Cocoa and I have no idea what is this > > pickerview. I don't create any pickerview myself. This pickerview > > appears myself when I click a select eleemnt on website. I forgot > > (maybe > > this is important information), I'm creating application for iPhone. > > > > > >>> On 22 Sep 2009, at 01:58, Bartosz Białecki wrote: > >>>> Hi, > >>>> I have small problem. I have WebView in my application and I open > >>>> website where there are some select elements. When I clicked on > >>>> select, > >>>> then PickerView appears. The problem is, when I click Done button > >>>> in > >>>> PickerView scrollbar in WebView changes his position. Does anyone > >>>> know > >>>> what's going on? > >>> > >>> What is this PickerView you're referring to? The closest matches I > >>> can > >>> find in the documentation are ABPeoplePickerView and > >>> QCCompositionPickerView, neither of which makes very much sense in > >>> context. > >> > >> > >> MODA NA SUKCES - zobacz drzewo bohaterów :) > >> Kliknij: > >> http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fdrzewo-moda.html&sid=866 > > > > > > MODA NA SUKCES - zobacz drzewo bohaterów :) > > Kliknij: > > http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fdrzewo-moda.html&sid=866 > > > > > > ___ > > > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > > > Please do not post admin requests or moderator comments to the list. > > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > > > Help/Unsubscribe/Update your Subscription: > > http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com > > > > This email sent to ag...@mac.com Dołącz się do Manify! Wyjdźmy na ulice, w WALCE O TAŃSZE PIWO! http://klik.wp.pl/?adr=www.zatanisci.pl&sid=856 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Hide keyboard in iPhone application
___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] WebView and problem with rotation
Hi, I have a problem with rotation. I have one root controller which switch between two views. In one of these views I have a webview control. In webview I show a tif or pdf file which size is bigger than window, so webview added scroll. The problem is when I rotate a device to landscape, I change a size of webview but scroll stays at position like in portrait mode. Does anybody know why? Best regards Bartosz Bialecki Wygraj wymarzony skuter! Wyznacz najprostszą drogę - docelu.pl - Kliknij: http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fchapman1.html&sid=863 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] WebView and problem with rotation
Hi, I use this in my code: webView.autoresizesSubviews = YES; webView.autoresizingMask = (UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth); but I think there is no any bug in my code, because I created a new project, which has only webview and open any website in it. When I click text input in that site and keyboard appeared and then I closed that keyboard and roatetd to landscape, the same problem occured. Maybe this is bug in webview control or I missing some another parameters? > Bartosz, > > It's a little difficult to know for sure without seeing your code, > but your comment that "I change a size of webview" makes me a bit > suspicious that you're not letting autoresizing do the work for you. I > have an app that uses a webview to display a pdf and it resizes > properly when switching between portrait and landscape without any > overt sizing action on my part. The trick is to set the > autoresizingMask property correctly to expand or contract to fill the > view. > > Bob > > On Oct 6, 2009, at 3:12 AM, Bartosz Białecki wrote: > > > Hi, > > I have a problem with rotation. I have one root controller which switch > > between two views. In one of these views I have a webview control. In > > webview I show a tif or pdf file which size is bigger than window, so > > webview added scroll. The problem is when I rotate a device to > > landscape, I change a size of webview but scroll stays at position like > > in portrait mode. Does anybody know why? > > > > Best regards > > Bartosz Bialecki > > > > > > Wygraj wymarzony skuter! > > Wyznacz najprostszą drogę - docelu.pl - Kliknij: > > http://klik.wp.pl/? > > adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fchapman1.html&sid=863 > > > > > > ___ > > > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > > > Please do not post admin requests or moderator comments to the list. > > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > > > Help/Unsubscribe/Update your Subscription: > > http://lists.apple.com/mailman/options/cocoa-dev/toadfoot%40comcast.net > > > > This email sent to toadf...@comcast.net > > 10 minut do cennych nagród, wykorzystaj szansę! Kliknij: http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fpentagon2.html&sid=877 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com