Objective-c - 如何正确包含修补过的框架标头

问题描述

我正在尝试为我的 theos iOS 应用程序在原始标头中重新启用一些标记API_UNAVAILABLE() 的 API,使用它的副本而不是直接修改它。

一切正常

#import <SystemConfiguration/SCNetworkConfiguration.h>

但是,如果我导入标题的副本

mkdir patched
cp /opt/theos/sdks/iPhoneOS14.4.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h patched/
// #import <SystemConfiguration/SCNetworkConfiguration.h>
#import "./patched/SCNetworkConfiguration.h"

Clang 恐慌 [1]

  • 如何正确包含修补过的 Objective-c 框架标头?
  • 是否可以使用编译器标志强制启用特定功能
  • 如果您有这种复制-补丁-导入方法以外的想法,也请告诉我。

免责声明 - 吃、睡和呼吸 C,但对 Objetive-C 不熟悉。


[1]

././patched/SCNetworkConfiguration.h:203:2: error: redeFinition of enumerator 'kSCBondStatusOK'
        kSCBondStatusOK                 = 0,/* enabled,active,running,... */
        ^
/opt/theos/sdks/iPhoneOS14.4.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h:203:2: note: prevIoUs deFinition is here
        kSCBondStatusOK                 = 0,... */
        ^
In file included from cfd.m:9:
././patched/SCNetworkConfiguration.h:204:2: error: redeFinition of enumerator 'kSCBondStatusLinkInvalid'
        kSCBondStatusLinkInvalid        = 1,/* The link state was not valid (i.e. down,half-duplex,wrong speed) */
        ^
/opt/theos/sdks/iPhoneOS14.4.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h:204:2: note: prevIoUs deFinition is here
        kSCBondStatusLinkInvalid        = 1,wrong speed) */
        ^
In file included from cfd.m:9:
././patched/SCNetworkConfiguration.h:205:2: error: redeFinition of enumerator 'kSCBondStatusnopartner'
        kSCBondStatusnopartner          = 2,/* The port on the switch that the device is connected doesn't seem to have 802.3ad Link Aggregation enabled */
        ^
/opt/theos/sdks/iPhoneOS14.4.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h:205:2: note: prevIoUs deFinition is here
        kSCBondStatusnopartner          = 2,/* The port on the switch that the device is connected doesn't seem to have 802.3ad Link Aggregation enabled */
        ^
In file included from cfd.m:9:
././patched/SCNetworkConfiguration.h:206:2: error: redeFinition of enumerator 'kSCBondStatusnotinActiveGroup'
        kSCBondStatusnotinActiveGroup   = 3,/* We're talking to a partner,but the link aggregation group is different from the one that's active */
        ^
/opt/theos/sdks/iPhoneOS14.4.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h:206:2: note: prevIoUs deFinition is here
        kSCBondStatusnotinActiveGroup   = 3,but the link aggregation group is different from the one that's active */
        ^
In file included from cfd.m:9:
././patched/SCNetworkConfiguration.h:207:2: error: redeFinition of enumerator 'kSCBondStatusUnkNown'
        kSCBondStatusUnkNown            = 999   /* Non-specific failure */
        ^
/opt/theos/sdks/iPhoneOS14.4.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h:207:2: note: prevIoUs deFinition is here
        kSCBondStatusUnkNown            = 999   /* Non-specific failure */
        ^

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)