从Service on启动时OSX Code Signature Invalid Exception

时间:2015-02-05 06:26:13

标签: objective-c macos sandbox code-signing finder

MyApp是一个带有Files & Folders服务功能的sondboxed应用程序。当我正常启动应用程序时,应用程序正常工作但是当它被Service调用时,它使得Finder几秒钟没有响应,而不是崩溃

控制台日志会出现以下崩溃

Process:               MyApp [4453]
Path:                  /Users/USER/Library/Developer/Xcode/Archives/2015-02-02/MyApp 02-02-2015 6.02 pm.xcarchive/Products/Applications/MyApp.app/Contents/MacOS/MyApp
Identifier:            com.Company.MyApp
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           MyApp [4453]
User ID:               501

Date/Time:             2015-02-05 11:06:20.391 +0500
OS Version:            Mac OS X 10.10.2 (14C109)
Report Version:        11
Anonymous UUID:        2B8F252E-AA04-6181-CCE8-379AB367F5EE


Time Awake Since Boot: 3600 seconds

Crashed Thread:        0

Exception Type:        EXC_CRASH (Code Signature Invalid)
Exception Codes:       0x0000000000000000, 0x0000000000000000

kernel messages:

VM Regions Near 0x7fff799630a8 (cr2):
    __LINKEDIT             00007fff63e95000-00007fff63ea9000 [   80K] r--/rwx SM=COW  /usr/lib/dyld
--> Submap                 00007fff70000000-00007fff80000000 [256.0M] r--/rwx SM=PRV  process-only VM submap
    unused shlib __DATA    00007fff775f9000-00007fff79b9c000 [ 37.6M] rw-/rw- SM=COW  system shared lib __DATA not used by this process

Thread 0 Crashed:
0   dyld                            0x00007fff63e26000 _dyld_start + 0

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x000000000000000d  rbx: 0x0000000000000000  rcx: 0x0000000000000000  rdx: 0x0000000000000000
  rdi: 0x0000000000000000  rsi: 0x0000000000000000  rbp: 0x0000000000000000  rsp: 0x00007fff586a1aa8
   r8: 0x0000000000000000   r9: 0x0000000000000000  r10: 0x0000000000000000  r11: 0x0000000000000000
  r12: 0x0000000000000000  r13: 0x0000000000000000  r14: 0x0000000000000000  r15: 0x0000000000000000
  rip: 0x00007fff63e26000  rfl: 0x0000000000000201  cr2: 0x00007fff799630a8

Logical CPU:     0
Error Code:      0x020000f4
Trap Number:     133


Binary Images:
    0x7fff63e25000 -     0x7fff63e5b837  dyld (???) <65DCCB06-339C-3E25-9702-600A28291D0E> /usr/lib/dyld

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 5435
    thread_create: 0
    thread_set_state: 93

VM Region Summary:
ReadOnly portion of Libraries: Total=300K resident=300K(100%) swapped_out_or_unallocated=0K(0%)
Writable regions: Total=8416K written=0K(0%) resident=12K(0%) swapped_out=0K(0%) unallocated=8404K(100%)

REGION TYPE                      VIRTUAL
===========                      =======
STACK GUARD                        56.0M
Stack                              8192K
VM_ALLOCATE                           8K
__DATA                              228K
__LINKEDIT                           80K
__TEXT                              220K
mapped file                         872K
shared memory                         4K
===========                      =======
TOTAL                              65.4M

明确指出它存在一些代码签名问题

  

异常类型:EXC_CRASH(代码签名无效)

下一个自然步骤应该是检查其签名,因此我使用spctl并返回

$ sudo spctl --assess --verbose=4 /Applications/MyApp.app
/Applications/MyApp.app: accepted
source=Developer ID

我不知道这里缺少什么。

更新


我在自己的计算机上创建了一个新帐户并运行了该应用程序,但未收到任何代码签名错误/异常。

因此,它与用户帐户的状态有关,或者可能是OSX的错误。

1 个答案:

答案 0 :(得分:2)

我怀疑您的服务是在您的开发目录中启动了应用程序的未签名副本。

您的第一次崩溃表明路径是:

/Users/USER/Library/Developer/Xcode/Archives/2015-02-02/MyApp 02-02-2015 6.02 pm.xcarchive/Products/Applications/MyApp.app/Contents/MacOS/MyApp

您发布的spctl命令检查了签名:

/Applications/MyApp.app.  

当您以开发人员帐户登录时,该服务可能会从您的Xcode / Archive目录中选择未签名的应用程序并失败。在/ Applications中手动启动已安装的版本,或者对该版本进行spctl检查,都会成功。使用其他用户帐户时,该服务可能会在/ Applications中找到该版本。