Automatic Reference Counting (ARC) not enforced
未强制启用自动引用计数 (ARC)
描述
自动引用计数 (ARC) 是一种内存管理机制,它通过编译器自动进行对象管理,从而减轻开发人员的负担。
建议
为整个项目启用 ARC:
- 打开 Xcode 项目。
- 进入项目设置。
- 选择目标 (target)。
- 导航到 "Build Settings" 选项卡。
- 搜索 "Objective-C Automatic Reference Counting"。
- 将 "Objective-C Automatic Reference Counting" 设置为 "YES"。
或者,为特定文件启用 ARC:
- 找到应启用 ARC 的文件。
- 在项目导航器中选择这些文件。
- 进入右侧的 "File Inspector"。
- 找到 "Compiler Flags" 部分。
- 将
-fobjc-arc添加到编译器标志中。 - 保存更改。
链接
- Automatic Reference Counting (Wikipedia)
- Automatic Reference Counting (LLVM)
- Automatic Reference Counting for Swift (Apple developer)
标准
- OWASP_MASVS_L1:
- MSTG_CODE_9
- OWASP_MASVS_L2:
- MSTG_CODE_9
- PCI_STANDARDS:
- REQ_2_2
- REQ_6_2
- OWASP_MASVS_v2_1:
- MASVS_RESILIENCE_4