CoreMotion显然从后台线程调用UI API

时间:2018-11-20 17:35:57

标签: xcode uikit xcode10 core-motion

在我的应用程序中,我正在初始化CMMotionManager。这发生在主线程上。这样做之后,Xcode 10主线程检查器指示

export BLPAPI_ROOT=/Users/kc/Documents/python/blpapi_cpp_3.8.1.1
export DYLD_LIBRARY_PATH=/Users/kc/Documents/python/blpapi_cpp_3.8.1.1/Darwin

copying blpapi/datetime.py -> build/lib.macosx-10.6-x86_64-2.7/blpapi
  copying blpapi/identity.py -> build/lib.macosx-10.6-x86_64-2.7/blpapi
  copying blpapi/topiclist.py -> build/lib.macosx-10.6-x86_64-2.7/blpapi
  copying blpapi/schema.py -> build/lib.macosx-10.6-x86_64-2.7/blpapi
  running build_ext
  building 'blpapi._internals' extension
  creating build/temp.macosx-10.6-x86_64-2.7
  creating build/temp.macosx-10.6-x86_64-2.7/blpapi
  gcc -fno-strict-aliasing -I/anaconda3/envs/py2.7/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/kelvincheng/Documents/python/kensho/blpapi_cpp_3.8.1.1/include -I/anaconda3/envs/py2.7/include/python2.7 -c blpapi/internals_wrap.cxx -o build/temp.macosx-10.6-x86_64-2.7/blpapi/internals_wrap.o
  blpapi/internals_wrap.cxx:3346:5: error: use of undeclared identifier 'blpapi_SessionOptions_print'
      blpapi_SessionOptions_print(
      ^
  blpapi/internals_wrap.cxx:3473:62: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings]
      PyObject* result = PyObject_CallFunction(loggerCallback, "KiIss",
                                                               ^
  blpapi/internals_wrap.cxx:4562:11: error: use of undeclared identifier 'blpapi_ProviderSession_terminateSubscriptionsOnTopics'
      res = blpapi_ProviderSession_terminateSubscriptionsOnTopics(sessionHandle, &topic, 1, message);
            ^
  blpapi/internals_wrap.cxx:4570:14: error: use of undeclared identifier 'blpapi_ProviderSession_flushPublishedEvents'
      int rc = blpapi_ProviderSession_flushPublishedEvents(
               ^
  blpapi/internals_wrap.cxx:9741:21: error: use of undeclared identifier 'blpapi_EventFormatter_appendFragmentedRecapMessage'
        result = (int)blpapi_EventFormatter_appendFragmentedRecapMessage(arg1,(char const *)arg2,arg3,(blpapi_Topic const *)arg4,(blpapi_CorrelationId_t_ const *)arg5,arg6);
                      ^
  blpapi/internals_wrap.cxx:9831:21: error: use of undeclared identifier 'blpapi_EventFormatter_appendFragmentedRecapMessageSeq'
        result = (int)blpapi_EventFormatter_appendFragmentedRecapMessageSeq(arg1,(char const *)arg2,arg3,(blpapi_Topic const *)arg4,arg5,arg6);
                      ^
  blpapi/internals_wrap.cxx:12598:21: error: use of undeclared identifier 'blpapi_SessionOptions_setServiceCheckTimeout'; did you mean '_wrap_blpapi_SessionOptions_setServiceCheckTimeout'?
        result = (int)blpapi_SessionOptions_setServiceCheckTimeout(arg1,arg2);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      _wrap_blpapi_SessionOptions_setServiceCheckTimeout
  blpapi/internals_wrap.cxx:12571:22: note: '_wrap_blpapi_SessionOptions_setServiceCheckTimeout' declared here
  SWIGINTERN PyObject *_wrap_blpapi_SessionOptions_setServiceCheckTimeout(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
                       ^
  blpapi/internals_wrap.cxx:12598:66: error: cannot initialize a parameter of type 'PyObject *' (aka '_object *') with an lvalue of type 'blpapi_SessionOptions_t *' (aka 'blpapi_SessionOptions *')
        result = (int)blpapi_SessionOptions_setServiceCheckTimeout(arg1,arg2);
                                                                   ^~~~
  blpapi/internals_wrap.cxx:12571:103: note: passing argument to parameter here
  SWIGINTERN PyObject *_wrap_blpapi_SessionOptions_setServiceCheckTimeout(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
                                                                                                        ^
  blpapi/internals_wrap.cxx:12649:21: error: use of undeclared identifier 'blpapi_SessionOptions_setServiceDownloadTimeout'; did you mean '_wrap_blpapi_SessionOptions_setServiceDownloadTimeout'?
        result = (int)blpapi_SessionOptions_setServiceDownloadTimeout(arg1,arg2);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      _wrap_blpapi_SessionOptions_setServiceDownloadTimeout
  blpapi/internals_wrap.cxx:12622:22: note: '_wrap_blpapi_SessionOptions_setServiceDownloadTimeout' declared here
  SWIGINTERN PyObject *_wrap_blpapi_SessionOptions_setServiceDownloadTimeout(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
                       ^
  blpapi/internals_wrap.cxx:12649:69: error: cannot initialize a parameter of type 'PyObject *' (aka '_object *') with an lvalue of type 'blpapi_SessionOptions_t *' (aka 'blpapi_SessionOptions *')
        result = (int)blpapi_SessionOptions_setServiceDownloadTimeout(arg1,arg2);
                                                                      ^~~~
  blpapi/internals_wrap.cxx:12622:106: note: passing argument to parameter here
  SWIGINTERN PyObject *_wrap_blpapi_SessionOptions_setServiceDownloadTimeout(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
                                                                                                           ^
  blpapi/internals_wrap.cxx:12676:3: error: unknown type name 'blpapi_TlsOptions_t'
    blpapi_TlsOptions_t *arg2 = (blpapi_TlsOptions_t *) 0 ;
    ^
  blpapi/internals_wrap.cxx:12676:32: error: use of undeclared identifier 'blpapi_TlsOptions_t'
    blpapi_TlsOptions_t *arg2 = (blpapi_TlsOptions_t *) 0 ;
                                 ^
  blpapi/internals_wrap.cxx:12676:53: error: expected expression
    blpapi_TlsOptions_t *arg2 = (blpapi_TlsOptions_t *) 0 ;
                                                      ^
  blpapi/internals_wrap.cxx:12694:28: error: unknown type name 'blpapi_TlsOptions_t'
    arg2 = reinterpret_cast< blpapi_TlsOptions_t * >(argp2);
                             ^
  blpapi/internals_wrap.cxx:12699:49: error: use of undeclared identifier 'blpapi_TlsOptions'
        blpapi_SessionOptions_setTlsOptions(arg1,(blpapi_TlsOptions const *)arg2);
                                                  ^
  blpapi/internals_wrap.cxx:12750:21: error: use of undeclared identifier 'blpapi_SessionOptions_setFlushPublishedEventsTimeout'; did you mean '_wrap_blpapi_SessionOptions_setFlushPublishedEventsTimeout'?
        result = (int)blpapi_SessionOptions_setFlushPublishedEventsTimeout(arg1,arg2);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      _wrap_blpapi_SessionOptions_setFlushPublishedEventsTimeout
  blpapi/internals_wrap.cxx:12723:22: note: '_wrap_blpapi_SessionOptions_setFlushPublishedEventsTimeout' declared here
  SWIGINTERN PyObject *_wrap_blpapi_SessionOptions_setFlushPublishedEventsTimeout(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
                       ^
  blpapi/internals_wrap.cxx:12750:74: error: cannot initialize a parameter of type 'PyObject *' (aka '_object *') with an lvalue of type 'blpapi_SessionOptions_t *' (aka 'blpapi_SessionOptions *')
        result = (int)blpapi_SessionOptions_setFlushPublishedEventsTimeout(arg1,arg2);
                                                                           ^~~~
  blpapi/internals_wrap.cxx:12723:111: note: passing argument to parameter here
  SWIGINTERN PyObject *_wrap_blpapi_SessionOptions_setFlushPublishedEventsTimeout(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
                                                                                                                ^
  blpapi/internals_wrap.cxx:13693:21: error: use of undeclared identifier 'blpapi_SessionOptions_serviceCheckTimeout'; did you mean 'blpapi_SessionOptions_connectTimeout'?
        result = (int)blpapi_SessionOptions_serviceCheckTimeout(arg1);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      blpapi_SessionOptions_connectTimeout
  /Users/kelvincheng/Documents/python/kensho/blpapi_cpp_3.8.1.1/include/blpapi_sessionoptions.h:214:14: note: 'blpapi_SessionOptions_connectTimeout' declared here
  unsigned int blpapi_SessionOptions_connectTimeout(
               ^
  blpapi/internals_wrap.cxx:13735:21: error: use of undeclared identifier 'blpapi_SessionOptions_serviceDownloadTimeout'
        result = (int)blpapi_SessionOptions_serviceDownloadTimeout(arg1);
                      ^
  blpapi/internals_wrap.cxx:13777:21: error: use of undeclared identifier 'blpapi_SessionOptions_flushPublishedEventsTimeout'
        result = (int)blpapi_SessionOptions_flushPublishedEventsTimeout(arg1);
                      ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  1 warning and 20 errors generated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------      
    Failed building wheel for blpapi
  Running setup.py clean for blpapi
Failed to build blpapi
Installing collected packages: blpapi
  Running setup.py install for blpapi ... error
    Complete output from command /anaconda3/envs/py2.7/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/pr/0ctg47rj1b9bj1dk943ll6n80000gn/T/pip-install-SjJNQg/blpapi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/pr/0ctg47rj1b9bj1dk943ll6n80000gn/T/pip-record-QCtiNA/install-record.txt --single-version-externally-managed --compile:

fatal error: too many errors emitted, stopping now [-ferror-limit=]
    1 warning and 20 errors generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/anaconda3/envs/py2.7/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/pr/0ctg47rj1b9bj1dk943ll6n80000gn/T/pip-install-SjJNQg/blpapi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/pr/0ctg47rj1b9bj1dk943ll6n80000gn/T/pip-record-QCtiNA/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/pr/0ctg47rj1b9bj1dk943ll6n80000gn/T/pip-install-SjJNQg/blpapi/
不会从主线程调用

。实际上,它来自

-[UIApplication applicationState] 

由于这是Apple的私有框架,因此在我看来,我只需要等待这个问题在Apple方面解决即可。我是否正确和/或有任何方法可以在不关闭主线程检查器的情况下解决此问题?

1 个答案:

答案 0 :(得分:3)

当前是API中的错误,后台线程中正在触发某些事情。

我可以用

阻止它
lazy var motionManager = CMMotionManager()

另请参阅https://github.com/JonasGessner/JGProgressHUD/issues/98,但目前没有解决方案。