Jump to content

iPhone: opening url from button to safari


  • Please log in to reply
3 replies to this topic

#1
alpineedge3

alpineedge3

    InsanelyMac Protégé

  • Members
  • Pip
  • 14 posts
hello,

i want to open a url from a UIButton in iPhone. I've attached this method to an IB button:

- (IBAction)doSendCode:(id)sender {
	[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com"]];
 }

When the method is called, the app shrinks away like it's going to open safari, but the whole simulator quits. There is no crash alert popup, so I am wondering if I'm doing something wrong or that's supposed to happen in the simulator.

#2
DaveGee

DaveGee

    InsanelyMac Protégé

  • Members
  • PipPip
  • 75 posts

hello,

i want to open a url from a UIButton in iPhone. I've attached this method to an IB button:

- (IBAction)doSendCode:(id)sender {
	[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com"]];
 }

When the method is called, the app shrinks away like it's going to open safari, but the whole simulator quits. There is no crash alert popup, so I am wondering if I'm doing something wrong or that's supposed to happen in the simulator.


Well... I'm not 100% sure but I downloaded some seismic indicator application from the Apple iPhone developer site and I think it was designed to do something similar... (when something was clicked a url was launched) and it too just 'ended' when you did the actual click...

You might want to find that code and check it out...

HTHs

Dave

#3
cpatch

cpatch

    InsanelyMac Protégé

  • Members
  • Pip
  • 5 posts
  • Gender:Male
  • Location:San Diego, CA
Try launching Safari on the simulator before you run your app. That worked for me with the seismic indicator demo app.

Craig

#4
alpineedge3

alpineedge3

    InsanelyMac Protégé

  • Members
  • Pip
  • 14 posts

Try launching Safari on the simulator before you run your app. That worked for me with the seismic indicator demo app.

Craig


@cpatch: That trick worked nicely. Thanks!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy