0
votes

I already set OS_ACTIVITY_MODE to disable, but after migrating to Xcode 9 there was some unwanted logs printing like the below.

Edit: I already referred Hide strange unwanted Xcode logs, but doesn't work for me in Xcode 9.

================================================================= Main Thread Checker: UI API called on a background thread: -[UIApplication registerForRemoteNotifications] PID: 1303, TID: 27861, Thread name: (none), Queue name: com.apple.usernotifications.UNUserNotificationServiceConnection.call-out, QoS: 0 Backtrace: 4 N-Gal 0x000000010b058211 _T05N_Gal11AppDelegateC29registerForRemoteNotificationyyFySb_s5Error_pSgtcfU_ + 193 5 N-Gal 0x000000010b0574d3 _T0Sbs5Error_pSgIxyx_SbSo7NSErrorCSgIyByy_TR + 115 6 libdispatch.dylib 0x0000000111a4c3f7 _dispatch_call_block_and_release + 12 7 libdispatch.dylib 0x0000000111a4d43c _dispatch_client_callout + 8 8 libdispatch.dylib 0x0000000111a5595b _dispatch_queue_serial_drain + 1162 9 libdispatch.dylib 0x0000000111a562df _dispatch_queue_invoke + 336 10 libdispatch.dylib 0x0000000111a5207d _dispatch_queue_override_invoke + 733 11 libdispatch.dylib 0x0000000111a591f9 _dispatch_root_queue_drain + 772 12 libdispatch.dylib 0x0000000111a58e97 _dispatch_worker_thread3 + 132 13 libsystem_pthread.dylib 0x0000000111f141ca _pthread_wqthread + 1387 14 libsystem_pthread.dylib 0x0000000111f13c4d start_wqthread + 13 Couldn't register: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo={NSLocalizedDescription=remote notifications are not supported in the simulator} Couldn't register: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo={NSLocalizedDescription=remote notifications are not supported in the simulator} Couldn't register: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo={NSLocalizedDescription=remote notifications are not supported in the simulator} 22

Can Anyone help me to hide these logs....? Thanks in advance!

2
@VinodKumar, please read my question carefully, i mentioned that, I already set OS_ACTIVITY_MODE to disable, i already referred that link and that doesn't work for me. And im asking this question for Xcode 9.Abirami Bala

2 Answers

1
votes

It's not just a log. It's a warning. [UIApplication registerForRemoteNotifications] must be called on the main thread. You should move call of this method to didFinishLaunchingWithOptions of your AppDelegate.

0
votes

It's not an unwanted log. You need to call registerForRemoteNotifications() in main thread.

Replace code as below.

let center  = UNUserNotificationCenter.current()
        center.delegate = self
        center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
            if error == nil{
                DispatchQueue.main.async {
                    UIApplication.shared.registerForRemoteNotifications()
                }
            }
        }