gpt4 book ai didi

ios - 是否可以在 Objective c 中打开正在运行的后台应用程序

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:51:55 31 4
gpt4 key购买 nike

在特定时间从后台运行我的应用程序。想做这样的事情

 - (void)applicationDidEnterBackground:(UIApplication *)application
{
timer = [NSTimer scheduledTimerWithTimeInterval:10
target:self
selector:@selector(timerFired:)
userInfo:nil
repeats:NO];
}

- (void)timerFired:(NSTimer*)timer
{

NSLog( @"yes it is running...");
PickUpCallViewController *call=[[PickUpCallViewController alloc]initWithNibName:@"PickUpCallViewController" bundle:nil];

navi=[[UINavigationController alloc]initWithRootViewController:call];
[[navi navigationController] setNavigationBarHidden:YES animated:YES];
window.rootViewController = navi;

[window makeKeyAndVisible];
}

最佳答案

当您应用程序进入后台模式时,无法以编程方式打开应用程序。但是使用 URL 方案,您可以从浏览器打开应用程序。

您只需按照以下屏幕截图设置 URL 方案:-

  • 首先你需要打开project-->Target-->info

enter image description here

  • 点击您在底部找到的信息后,如下图所示:

enter image description here

  • 点击 URL Type 你会得到如下截图所示的结果:

enter image description here

  • 点击 (+) 并设置 URL-Schemes 如下:

enter image description here

点击主页按钮并打开您的 safari 浏览器,保存并最小化您的应用程序。并在保存之前输入您正在设置的 mytestApp://,如下图所示:-

enter image description here

所有过程都正常工作,例如:-

enter image description here

关于ios - 是否可以在 Objective c 中打开正在运行的后台应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23632405/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com