我正在使用
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"www.google"]];打开Safari并重定向到URL。
to open Safari and redirect to a URL.
在哪里可以放置此代码,以便程序在启动时运行此代码?
Where can I put this code in so as to let the program run this code at start-up?
一开始,我有 HelloWorldViewController文件.h, HelloWorldViewController.m和XCode 4生成的 HelloWorldViewController.xlb。
At the beginning, I have the file of "HelloWorldViewController.h", "HelloWorldViewController.m" and "HelloWorldViewController.xlb" that are generated by XCode 4.
已更新,我将以下代码添加到xxxx.m文件中,但不起作用,请帮助
Updated, I added the code as below to xxxx.m file, but not works, please help
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"www.google"]]; }推荐答案
好然后在statup上运行它。...
Ok, if you want to run it on statup then....
-(BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions这在应用程序委托中。...不确定为什么您将要执行此操作,还是Apple是否会批准这样的应用程序...?
This is in the App Delegate....not sure why you would want to do this or whether Apple would even approve such an app...?
如果要显示Web内容,则可以使用UIWebview并加载该网址....
If you want to show web content then you can use a UIWebview and load the URL into that....
更多推荐
在程序启动时运行代码
发布评论