2016-11-16 61 views
6

节省调试时间,因为我在搜索神秘应用程序崩溃后的2周内浪费了大量时间。事实证明,如果您向UNUserNotificationCenter添加很多o(请参阅回答以获取更多详细信息)通知请求,它会突然崩溃Springboard。我还没有找到解决办法,因为相同的代码适用于iOS 9及以下版本。您似乎无法像以前那样批量添加通知请求。以下是我每次收到的崩溃(数百名应用用户也是如此)。任何想法我可以做,而不是回到使用UILocalNotification s?当向UNUserNotificationCenter添加大量触发器时,跳板崩溃

Incident Identifier: 17BC9D5B-AF74-4592-8427-038375C27AE7 
CrashReporter Key: a819553d1e72ee25a5ced9ddc79dbf00a7d3851f 
Hardware Model:  iPad5,3 
Process:    SpringBoard [2371] 
Path:    /System/Library/CoreServices/SpringBoard.app/SpringBoard 
Identifier:   com.apple.springboard 
Version:    50 (1.0) 
Code Type:   ARM-64 (Native) 
Role:    Foreground 
Parent Process:  launchd [1] 
Coalition:   com.apple.springboard [71] 


Date/Time:   2016-11-16 14:57:04.9159 +0400 
Launch Time:   2016-11-16 14:49:20.9981 +0400 
OS Version:   iPhone OS 10.0 (14A5309d) 
Report Version:  104 

Exception Type: EXC_CRASH (SIGABRT) 
Exception Codes: 0x0000000000000000, 0x0000000000000000 
Exception Note: EXC_CORPSE_NOTIFY 
Triggered by Thread: 13 

Filtered syslog: 
None found 

Thread 0 name: Dispatch queue: com.apple.main-thread 
Thread 0: 
0 libsystem_kernel.dylib   0x0000000180624194 mach_msg_trap + 8 
1 libsystem_kernel.dylib   0x0000000180624004 mach_msg + 72 
2 CoreFoundation     0x0000000180a61e8c __CFRunLoopServiceMachPort + 192 
3 CoreFoundation     0x0000000180a5faa8 __CFRunLoopRun + 1132 
4 CoreFoundation     0x000000018098f8d8 CFRunLoopRunSpecific + 444 
5 GraphicsServices    0x0000000182396198 GSEventRunModal + 180 
6 UIKit       0x00000001869327c8 -[UIApplication _run] + 664 
7 UIKit       0x000000018692d534 UIApplicationMain + 208 
8 libdyld.dylib     0x00000001805305b8 start + 4 

Thread 1 name: com.apple.uikit.eventfetch-thread 
Thread 1: 
0 libsystem_kernel.dylib   0x0000000180624194 mach_msg_trap + 8 
1 libsystem_kernel.dylib   0x0000000180624004 mach_msg + 72 
2 CoreFoundation     0x0000000180a61e8c __CFRunLoopServiceMachPort + 192 
3 CoreFoundation     0x0000000180a5faa8 __CFRunLoopRun + 1132 
4 CoreFoundation     0x000000018098f8d8 CFRunLoopRunSpecific + 444 
5 Foundation      0x000000018142ce3c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 
6 Foundation      0x000000018144d92c -[NSRunLoop(NSRunLoop) runUntilDate:] + 96 
7 UIKit       0x000000018727af2c -[UIEventFetcher threadMain] + 136 
8 Foundation      0x00000001815293ac __NSThread__start__ + 1024 
9 libsystem_pthread.dylib   0x00000001807079ec _pthread_body + 240 
10 libsystem_pthread.dylib   0x00000001807078fc _pthread_body + 0 
11 libsystem_pthread.dylib   0x0000000180704ef8 thread_start + 4 

Thread 2: 
0 libsystem_kernel.dylib   0x0000000180624194 mach_msg_trap + 8 
1 libsystem_kernel.dylib   0x0000000180624004 mach_msg + 72 
2 CoreFoundation     0x0000000180a61e8c __CFRunLoopServiceMachPort + 192 
3 CoreFoundation     0x0000000180a5faa8 __CFRunLoopRun + 1132 
4 CoreFoundation     0x000000018098f8d8 CFRunLoopRunSpecific + 444 
5 Foundation      0x000000018142ce3c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 
6 Foundation      0x0000000181481584 -[NSRunLoop(NSRunLoop) run] + 88 
7 UIKit       0x0000000186f73298 -[UIStatusBarServerThread main] + 840 
8 Foundation      0x00000001815293ac __NSThread__start__ + 1024 
9 libsystem_pthread.dylib   0x00000001807079ec _pthread_body + 240 
10 libsystem_pthread.dylib   0x00000001807078fc _pthread_body + 0 
11 libsystem_pthread.dylib   0x0000000180704ef8 thread_start + 4 

Thread 3: 
0 libsystem_kernel.dylib   0x0000000180624194 mach_msg_trap + 8 
1 libsystem_kernel.dylib   0x0000000180624004 mach_msg + 72 
2 CoreFoundation     0x0000000180a61e8c __CFRunLoopServiceMachPort + 192 
3 CoreFoundation     0x0000000180a5faa8 __CFRunLoopRun + 1132 
4 CoreFoundation     0x000000018098f8d8 CFRunLoopRunSpecific + 444 
5 Foundation      0x000000018142ce3c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 
6 CoreBrightness     0x0000000190ec5d10 -[BrightnessSystemClientInternal main] + 1392 
7 Foundation      0x00000001815293ac __NSThread__start__ + 1024 
8 libsystem_pthread.dylib   0x00000001807079ec _pthread_body + 240 
9 libsystem_pthread.dylib   0x00000001807078fc _pthread_body + 0 
10 libsystem_pthread.dylib   0x0000000180704ef8 thread_start + 4 

Thread 4: 
0 libsystem_kernel.dylib   0x0000000180624194 mach_msg_trap + 8 
1 libsystem_kernel.dylib   0x0000000180624004 mach_msg + 72 
2 CoreFoundation     0x0000000180a61e8c __CFRunLoopServiceMachPort + 192 
3 CoreFoundation     0x0000000180a5faa8 __CFRunLoopRun + 1132 
4 CoreFoundation     0x000000018098f8d8 CFRunLoopRunSpecific + 444 
5 SpringBoard      0x00000001001a0b00 0x1000f0000 + 723712 
6 libsystem_pthread.dylib   0x00000001807079ec _pthread_body + 240 
7 libsystem_pthread.dylib   0x00000001807078fc _pthread_body + 0 
8 libsystem_pthread.dylib   0x0000000180704ef8 thread_start + 4 

Thread 5 name: com.apple.springboard.icongeneration 
Thread 5: 
0 libsystem_kernel.dylib   0x0000000180624194 mach_msg_trap + 8 
1 libsystem_kernel.dylib   0x0000000180624004 mach_msg + 72 
2 CoreFoundation     0x0000000180a61e8c __CFRunLoopServiceMachPort + 192 
3 CoreFoundation     0x0000000180a5faa8 __CFRunLoopRun + 1132 
4 CoreFoundation     0x000000018098f8d8 CFRunLoopRunSpecific + 444 
5 SpringBoard      0x00000001001a0c00 0x1000f0000 + 723968 
6 libsystem_pthread.dylib   0x00000001807079ec _pthread_body + 240 
7 libsystem_pthread.dylib   0x00000001807078fc _pthread_body + 0 
8 libsystem_pthread.dylib   0x0000000180704ef8 thread_start + 4 

Thread 6 name: com.apple.CoreMotion.MotionThread 
Thread 6: 
0 libsystem_kernel.dylib   0x0000000180624194 mach_msg_trap + 8 
1 libsystem_kernel.dylib   0x0000000180624004 mach_msg + 72 
2 CoreFoundation     0x0000000180a61e8c __CFRunLoopServiceMachPort + 192 
3 CoreFoundation     0x0000000180a5faa8 __CFRunLoopRun + 1132 
4 CoreFoundation     0x000000018098f8d8 CFRunLoopRunSpecific + 444 
5 CoreFoundation     0x00000001809dd094 CFRunLoopRun + 112 
6 CoreMotion      0x0000000187762994 0x187702000 + 395668 
7 libsystem_pthread.dylib   0x00000001807079ec _pthread_body + 240 
8 libsystem_pthread.dylib   0x00000001807078fc _pthread_body + 0 
9 libsystem_pthread.dylib   0x0000000180704ef8 thread_start + 4 

Thread 7 name: SBWiFiManager callback thread 
Thread 7: 
0 libsystem_kernel.dylib   0x0000000180624194 mach_msg_trap + 8 
1 libsystem_kernel.dylib   0x0000000180624004 mach_msg + 72 
2 CoreFoundation     0x0000000180a61e8c __CFRunLoopServiceMachPort + 192 
3 CoreFoundation     0x0000000180a5faa8 __CFRunLoopRun + 1132 
4 CoreFoundation     0x000000018098f8d8 CFRunLoopRunSpecific + 444 
5 Foundation      0x000000018142ce3c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 
6 Foundation      0x0000000181481584 -[NSRunLoop(NSRunLoop) run] + 88 
7 SpringBoard      0x0000000100215e44 0x1000f0000 + 1203780 
8 Foundation      0x00000001815293ac __NSThread__start__ + 1024 
9 libsystem_pthread.dylib   0x00000001807079ec _pthread_body + 240 
10 libsystem_pthread.dylib   0x00000001807078fc _pthread_body + 0 
11 libsystem_pthread.dylib   0x0000000180704ef8 thread_start + 4 

Thread 8: 
0 libsystem_kernel.dylib   0x0000000180624194 mach_msg_trap + 8 
1 libsystem_kernel.dylib   0x0000000180624004 mach_msg + 72 
2 CoreFoundation     0x0000000180a61e8c __CFRunLoopServiceMachPort + 192 
3 CoreFoundation     0x0000000180a5faa8 __CFRunLoopRun + 1132 
4 CoreFoundation     0x000000018098f8d8 CFRunLoopRunSpecific + 444 
5 Foundation      0x000000018142ce3c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 
6 HomeKit       0x00000001913e8974 -[_HMLocationHandler createLocationManager] + 508 
7 Foundation      0x00000001815293ac __NSThread__start__ + 1024 
8 libsystem_pthread.dylib   0x00000001807079ec _pthread_body + 240 
9 libsystem_pthread.dylib   0x00000001807078fc _pthread_body + 0 
10 libsystem_pthread.dylib   0x0000000180704ef8 thread_start + 4 

Thread 9: 
0 libsystem_kernel.dylib   0x0000000180624194 mach_msg_trap + 8 
1 libsystem_kernel.dylib   0x0000000180624004 mach_msg + 72 
2 CoreFoundation     0x0000000180a61e8c __CFRunLoopServiceMachPort + 192 
3 CoreFoundation     0x0000000180a5faa8 __CFRunLoopRun + 1132 
4 CoreFoundation     0x000000018098f8d8 CFRunLoopRunSpecific + 444 
5 Foundation      0x000000018142ce3c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 
6 CoreBrightness     0x0000000190ec5d10 -[BrightnessSystemClientInternal main] + 1392 
7 Foundation      0x00000001815293ac __NSThread__start__ + 1024 
8 libsystem_pthread.dylib   0x00000001807079ec _pthread_body + 240 
9 libsystem_pthread.dylib   0x00000001807078fc _pthread_body + 0 
10 libsystem_pthread.dylib   0x0000000180704ef8 thread_start + 4 

Thread 10 name: CommonUtilities-WiFi-Thread 
Thread 10: 
0 libsystem_kernel.dylib   0x0000000180624194 mach_msg_trap + 8 
1 libsystem_kernel.dylib   0x0000000180624004 mach_msg + 72 
2 CoreFoundation     0x0000000180a61e8c __CFRunLoopServiceMachPort + 192 
3 CoreFoundation     0x0000000180a5faa8 __CFRunLoopRun + 1132 
4 CoreFoundation     0x000000018098f8d8 CFRunLoopRunSpecific + 444 
5 CoreFoundation     0x00000001809dd094 CFRunLoopRun + 112 
6 CommonUtilities     0x0000000182d10c20 0x182d0a000 + 27680 
7 Foundation      0x00000001815293ac __NSThread__start__ + 1024 
8 libsystem_pthread.dylib   0x00000001807079ec _pthread_body + 240 
9 libsystem_pthread.dylib   0x00000001807078fc _pthread_body + 0 
10 libsystem_pthread.dylib   0x0000000180704ef8 thread_start + 4 

Thread 11: 
0 libsystem_kernel.dylib   0x0000000180642a88 __workq_kernreturn + 8 
1 libsystem_pthread.dylib   0x000000018070549c _pthread_wqthread + 1440 
2 libsystem_pthread.dylib   0x0000000180704ef0 start_wqthread + 4 

Thread 12: 
0 libsystem_kernel.dylib   0x0000000180642a88 __workq_kernreturn + 8 
1 libsystem_pthread.dylib   0x000000018070549c _pthread_wqthread + 1440 
2 libsystem_pthread.dylib   0x0000000180704ef0 start_wqthread + 4 

Thread 13 name: Dispatch queue: com.apple.frontboard.sqlite.database 
Thread 13 Crashed: 
0 libsystem_kernel.dylib   0x0000000180642014 __pthread_kill + 8 
1 libsystem_pthread.dylib   0x00000001807094f0 pthread_kill + 112 
2 libsystem_c.dylib    0x00000001805b64b8 abort + 140 
3 libsystem_malloc.dylib   0x0000000180686a38 _nano_vet_and_size_of_live + 0 
4 libsystem_malloc.dylib   0x0000000180687db8 nano_free + 220 
5 libsqlite3.dylib    0x000000018103a5f8 0x180f95000 + 677368 
6 libsqlite3.dylib    0x0000000180fbac9c 0x180f95000 + 154780 
7 libsqlite3.dylib    0x0000000180fe6074 0x180f95000 + 331892 
8 libsqlite3.dylib    0x0000000180fd70b0 sqlite3_step + 588 
9 FrontBoard      0x0000000190312ee4 __79-[_FBSqlitePreparedSimpleStatement executeWithBindings:resultRowHandler:error:]_block_invoke + 424 
10 libdispatch.dylib    0x00000001804fd784 _dispatch_client_callout + 16 
11 libdispatch.dylib    0x000000018050aca4 _dispatch_barrier_sync_f_invoke + 84 
12 FrontBoard      0x000000019031e0d0 -[FBSqliteDatabaseConnection performSyncWithDatabase:] + 80 
13 FrontBoard      0x0000000190312cbc -[_FBSqlitePreparedSimpleStatement executeWithBindings:resultRowHandler:error:] + 148 
14 FrontBoard      0x000000019035a4d8 -[FBSqliteApplicationDataStoreRepository _dbQueue_executeStatement:bindings:resultRowHandler:error:] + 80 
15 FrontBoard      0x000000019035a538 -[FBSqliteApplicationDataStoreRepository _dbQueue_executeStatement:bindings:resultRowHandler:] + 72 
16 FrontBoard      0x0000000190359374 -[FBSqliteApplicationDataStoreRepository _dbQueue_objectForKey:forApplication:] + 504 
17 FrontBoard      0x0000000190357a34 __81-[FBSqliteApplicationDataStoreRepository objectForKey:forApplication:withResult:]_block_invoke.44 + 40 
18 libdispatch.dylib    0x00000001804fd784 _dispatch_client_callout + 16 
19 libdispatch.dylib    0x000000018050aca4 _dispatch_barrier_sync_f_invoke + 84 
20 FrontBoard      0x0000000190357990 -[FBSqliteApplicationDataStoreRepository objectForKey:forApplication:withResult:] + 92 
21 FrontBoard      0x000000019038a5cc -[FBApplicationDataStoreInProcessRepositoryClient objectForKey:forApplication:withResult:checkPrefetch:] + 528 
22 FrontBoardServices    0x00000001825c3e3c __40-[FBSApplicationDataStore objectForKey:]_block_invoke + 112 
23 libdispatch.dylib    0x00000001804fd784 _dispatch_client_callout + 16 
24 libdispatch.dylib    0x0000000180508f80 _dispatch_block_invoke_direct + 376 
25 BaseBoard      0x00000001825415a8 -[NSObject(BaseBoard) bs_performSynchronously:timeout:] + 144 
26 FrontBoardServices    0x00000001825c3d7c -[FBSApplicationDataStore objectForKey:] + 224 
27 FrontBoardServices    0x00000001825c4044 -[FBSApplicationDataStore safeObjectForKey:ofType:] + 32 
28 FrontBoardServices    0x00000001825c41d4 -[FBSApplicationDataStore archivedObjectForKey:] + 64 
29 FrontBoardServices    0x00000001825c4314 -[FBSApplicationDataStore safeArchivedObjectForKey:ofType:] + 32 
30 UserNotificationsServer   0x000000019c52169c -[UNSPendingNotificationRepository _pendingNotificationDictionariesForBundleIdentifier:] + 140 
31 UserNotificationsServer   0x000000019c5219d0 -[UNSPendingNotificationRepository setPendingNotificationRecords:forBundleIdentifier:] + 72 
32 UserNotificationsServer   0x000000019c5249b4 -[UNSLocalNotificationClient _setPendingNotificationRecords:] + 500 
33 UserNotificationsServer   0x000000019c5235c4 -[UNSLocalNotificationClient addPendingNotificationRecords:] + 1124 
34 UserNotificationsServer   0x000000019c51d648 -[UNSNotificationSchedulingService _queue_addPendingNotificationRecords:forBundleIdentifier:] + 84 
35 UserNotificationsServer   0x000000019c51c6b0 __108-[UNSNotificationSchedulingService addPendingNotificationRecords:forBundleIdentifier:withCompletionHandler:]_block_invoke + 36 
36 libdispatch.dylib    0x00000001804fd7c4 _dispatch_call_block_and_release + 24 
37 libdispatch.dylib    0x00000001804fd784 _dispatch_client_callout + 16 
38 libdispatch.dylib    0x000000018050b880 _dispatch_queue_serial_drain + 928 
39 libdispatch.dylib    0x0000000180500f6c _dispatch_queue_invoke + 652 
40 libdispatch.dylib    0x000000018050bd7c _dispatch_queue_override_invoke + 360 
41 libdispatch.dylib    0x000000018050d718 _dispatch_root_queue_drain + 572 
42 libdispatch.dylib    0x000000018050d478 _dispatch_worker_thread3 + 124 
43 libsystem_pthread.dylib   0x00000001807053f8 _pthread_wqthread + 1276 
44 libsystem_pthread.dylib   0x0000000180704ef0 start_wqthread + 4 

UPDATE:它似乎并没有根据通知的具体数量。我碰巧经常触发它,因为当应用程序在后台(推送通知,应用程序刷新,应用程序转到后台等)时,我已经注册了大约30到40个通知 - 由于异步添加这些警报需要更长的时间,该应用程序将同时放弃其拥有的后台任务标识符。我已经在下面详细解释了这一点,以及解决方法。

此漏洞已被Apple确认并标记为之前报告的错误的副本。我希望这个问题得到解决,因为它会在某些边缘情况下继续引发问题,例如应用程序在后台启动并在不久之后超时(在后台内容刷新期间)。

+0

有趣。感谢分享。关于多少是“很多”? – shallowThought

+0

30到40之间的任何内容。基本上,您必须按下电源按钮以关闭屏幕,重新启动应用程序并重新启动,然后尝试删除并添加更多通知。几次后,你会看到崩溃。我通过在添加通知后添加runloop等待来修复它,并且只有在完成添加通知后才释放锁定。它似乎是一个iOS的错误,但花了我一段时间找出一个解决方法。 – strangetimes

+0

@shallowThought我已经用一个解决方法更新了这个问题。我对苹果工程师的监督感到震惊。他们声称WWDC期间的功能平价,但新的UNUserNotificationCenter甚至不让我们像我们以前那样批量分配通知(而不是循环20次需要注册的通知)。 – strangetimes

回答

2

我找到了一个解决办法

本质(已经登录与苹果的错误ID 29286162错误),似乎跳板崩溃,如果该UNUserNotificationCenter忙添加通知和其还没有完成这样做,当用户按下主页按钮返回到SpringBoard。显然,线程正在死亡(好吧,可能是因为我不得不放弃后台任务标识符,希望UNUserNotificationCenter会愉快地在自己的系统提供的后台线程中使用传递的请求),而将正在进行的异步操作在空洞,导致跳板最终崩溃。我现在只是在后台任务(UIBackgroundTaskIdentifier)中产生一个线程,并保留它直到完成添加所有通知。这导致零事故 - 所有先前抱怨过的用户也证实了这一点。

// arrTasksToSchedule -> holds UNNotificationRequests to add 

    __block NSInteger volatile processedAlerts = 0; 
    NSInteger totalToProcess = [arrTasksToSchedule count]; 
    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; 
    for (UNNotificationRequest* notifRequest in arrTasksToSchedule) { 
    [center addNotificationRequest:notifRequest withCompletionHandler:^(NSError * _Nullable error) { 
     processedAlerts++; 
    }]; 
    } 

    // Let the runloop carry on processing events till we're done 
    while (processedAlerts != totalToProcess) { 
    [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; 
    } 

    // Okay we're done, and can now let go of our held UIBackgroundTaskIdentifier 

文档只字未提后台任务,在后台任务或任何使用UNUserNotificationCenter多线程等做的危险我只能假设他们没有意识到大多数应用程序做他们的通知,注册在自己的应用程序发送到后台(或在后台内容刷新推送通知期间)。

由于Springboard崩溃 - 应用程序本身没有生成崩溃报告。用户不停地抱怨,这是你一无所知的非常困难的情况之一。我希望这能节省很多人的头痛。

UPDATE:虽然现在的代码上面的工作就好了,我做了一个稍微修饰的while循环的条件,不得以的情况下满足用户关闭应用程序按下电源按钮来切换屏幕关闭。在这种情况下,runloop显然没有任何可处理的内容,并且会被阻塞。相反,下面的伎俩:

// Wait in a run loop 
while (processedAlerts != totalToProcess) { 
    [NSThread sleepForTimeInterval:0.15]; 

    // Don't use the following, as it will stop firing in case 
    // the runloop has no events (such as touch events) firing 
    // [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; 
} 
+0

我认为这个问题比以前的想法还要糟糕。当我的应用程序处于前台时,我能够触发跳板崩溃。我(当前!)每次用户启动计时器或跳过进入下一个时间段时,都会为未来的Pomodoro计时器配置64个通知。所有异步回调完成大约需要6秒钟的时间!通过反复点击跳过,并删除和创建越来越多的通知,我可以得到一个跳板崩溃。很明显,我需要在我的应用程序中变得更聪明,但问题不仅仅在于后台执行。 –

+0

@GeoffHackworth我敢肯定,这已经超过一个月了,而且我仍然*发生火灾,全部与通知有关。我已经设法让应用程序不会崩溃,但通过这么做,有大量警报的“重度用户”不再能够使用该应用程序,这很让人伤心。我也没有在10.2测试版中看到这个问题,所以我会敦促你向苹果公司提供一个雷达,以便它们能够继续。提交的错误越多,看到修复的几率就越高。 – strangetimes

+0

@GeoffHackworth值得指出的是,您注册的警报越多,看起来越慢,注册时间越长。这就是为什么我以最多25到30条警报为限(因此用户有更多的警报受到影响),但超过30条警报的应用程序和应用程序需要太长的时间才能注册警报。 – strangetimes

3

近日在Todoist的人发布的信息显示,他们已经围绕跳板崩溃工作的更新(11.2.7)。

Todoist 11.2.7 Release Notes

后不久,苹果iOS 10.2释放。从那以后,我开始从我的应用程序的用户那里收到报告已经解决的错误。然而,在Todoist的家伙好奇的是如何解决问题的工作,我接触了他们,这是他们的领导iOS开发者与我分享:

嗨俊杰,

是的,你说得对。 iOS 10中的跳板实际上是与调度本地用户通知相关的 。该问题实际上是在iOS 10.2上修复的 ,但我们也通过 对iOS 10.1进行了修复,对用户通知进行了必要的更改。之前,我们在加入 所有请求,而不管他们是否已经加入了,我们开始 与已经计划对它们进行比较,只是添加那些 不同:

让requestsToAdd = requestsToSchedule.filter {pendingRequests!包含($ 0)}

希望这会有所帮助。

努诺