如何暂停cordova应用程序在后台ios中运行

问题描述 投票:0回答:1

我有一个cordova应用,它与许多计时器有关。基本上,它们只是从100到0计数,最后播放声音。我已经意识到,当我的应用程序移至后台时(即通过按下主屏幕按钮),它们不会停止计数。在Android上,我通过将config.xml中的“ keepRunning”首选项设置为false解决了它。

<preference name="keepRunning" value="false" />

问题是我无法阻止它在ios设备(具体来说是模拟器)上在后台运行。我发现的所有文章和帖子都是关于如何使其保持运行的,但实际上我需要的却是相反的。我也没有关闭该应用程序。只是为了暂停它。我曾考虑过使用“ onPause()”函数,但我真的不知道在那写什么。有任何想法吗?预先感谢。

javascript html ios cordova phonegap
1个回答
0
投票

您是如何使其在ios上工作的?这就是我所拥有的

    <preference name="deployment-target" value="10.0" />

到目前为止,编译时出现了很多错误。

In module 'AssetsLibrary' imported from /project/CordovaLib/Classes/Public/CDVURLProtocol.m:20:
/Applications/Xcode101.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/AssetsLibrary.framework/Headers/ALAssetsLibrary.h:64:16: note: 'ALAssetsLibraryAssetForURLResultBlock' has been explicitly marked deprecated here
typedef void (^ALAssetsLibraryAssetForURLResultBlock)(ALAsset *asset) NS_DEPRECATED_IOS(4_0, 9_0, "Use fetchAssetsWithLocalIdentifiers:options: on PHAsset to fetch assets by local identifier (or to lookup PHAssets by a previously known ALAssetPropertyAssetURL use fetchAssetsWithALAssetURLs:options:) from the Photos framework instead");
               ^
/project/CordovaLib/Classes/Public/CDVURLProtocol.m:63:69: warning: 'defaultRepresentation' is deprecated: first deprecated in iOS 9.0 - Use PHImageRequestOptions with the PHImageManager from the Photos framework instead [-Wdeprecated-declarations]
                ALAssetRepresentation* assetRepresentation = [asset defaultRepresentation];

我很抱歉在您的主题中发帖,但现在没有人回答有关电话间隙的任何内容

© www.soinside.com 2019 - 2024. All rights reserved.