Gur*_*ngh 1 ios13 xcode11 swift5.1
我正在实现BackgroundTasks框架来更新数据。但是我遇到了以下问题
Could not schedule refreshApp: Error Domain=BGTaskSchedulerErrorDomain Code=1 "(null)"
Could not schedule data featch: Error Domain=BGTaskSchedulerErrorDomain Code=1 "(null)"
2019-10-01 19:19:32.550320+0530 SOBackgroundTask[34131:1129470] Can't end BackgroundTask: no background task exists with identifier 3 (0x3), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
Run Code Online (Sandbox Code Playgroud)
dem*_*ten 32
以下是Domain=BGTaskSchedulerErrorDomain从 ObjC 标头中提取的可能错误代码,并附有一些解释。
BGTaskSchedulerErrorCodeUnavailable = 1// 后台任务调度功能不适用于此应用程序/扩展程序。后台应用刷新可能已在“设置”中禁用。
BGTaskSchedulerErrorCodeTooManyPendingTaskRequests = 2// 无法提交任务请求,因为该类型的待处理任务请求过多。在重试之前取消一些现有的任务请求。
BGTaskSchedulerErrorCodeNotPermitted = 3 // 无法提交任务请求,因为 UIBackgroundModes 数组中未包含相应的后台模式,或者其标识符不存在于应用程序的 Info.plist 中的 BGTaskSchedulerPermittedIdentifiers 数组中。
小智 8
为了:
\n\nBGTaskSchedulerErrorDomain error 3\nRun Code Online (Sandbox Code Playgroud)\n\n检查project\xe2\x80\x99s.xcodeproj文件内部是否有适当的目标。然后转到“信息”选项卡和“自定义 iOS 目标属性”BGTaskSchedulerPermittedIdentifiers ,并检查是否添加了允许的后台任务计划程序标识符 ( )。
这解决了我添加BackgroundTasks到现有项目时的问题。
| 归档时间: |
|
| 查看次数: |
733 次 |
| 最近记录: |