我正在创建一个沙盒应用程序,并已获得自动启动与servicmanagement框架的工作。然而,servicmanagement框架已经被Swift弃用了(从Xcode 7 beta 3开始),因为"servicmanagement .framework模块映射"现在包含了这一行requires !swift
.
这会产生错误
导入servicmanagement时,输入Could not build Objective-C module 'ServiceManagement'
和Module 'ServiceManagement' is incompatible with the feature 'Swift'
。如何使自动启动工作与Swift和没有servicmanagement框架?
我找到的解决方案是添加一个桥接头文件,并在该文件中导入框架。然后Swift就可以像以前一样使用它了。
#import <ServiceManagement/SMLoginItem.h>