zoukankan
html css js c++ java
ARC专题:编写兼容ARC(自动引用计数) 和 nonARC(非自动引用计数)的通用代码
下面这段宏可以解决这个问题,而不用同时编写2套代码
写法用传统的non-ARC写法
http://raptureinvenice.com/arc-support-without-branches/
// // ARCMacros.h // InnerBand // // For an explanation of why these work, see: // // http://raptureinvenice.com/arc-support-without-branches/ // // Created by John Blanco on 1/28/12. // Rapture In Venice releases all rights to this code. Feel free use and/or copy it openly and freely! // // NOTE: __bridge_tranfer is not included here because releasing would be inconsistent. // Avoid it unless you're using ARC exclusively or managing it with __has_feature(objc_arc). // #if !defined(__clang__) || __clang_major__ < 3 #ifndef __bridge #define __bridge #endif #ifndef __bridge_retain #define __bridge_retain #endif #ifndef __bridge_retained #define __bridge_retained #endif #ifndef __autoreleasing #define __autoreleasing #endif #ifndef __strong #define __strong #endif #ifndef __unsafe_unretained #define __unsafe_unretained #endif #ifndef __weak #define __weak #endif #endif #if __has_feature(objc_arc) #define SAFE_ARC_PROP_RETAIN strong #define SAFE_ARC_RETAIN(x) (x) #define SAFE_ARC_RELEASE(x) #define SAFE_ARC_AUTORELEASE(x) (x) #define SAFE_ARC_BLOCK_COPY(x) (x) #define SAFE_ARC_BLOCK_RELEASE(x) #define SAFE_ARC_SUPER_DEALLOC() #define SAFE_ARC_AUTORELEASE_POOL_START() @autoreleasepool { #define SAFE_ARC_AUTORELEASE_POOL_END() } #else #define SAFE_ARC_PROP_RETAIN retain #define SAFE_ARC_RETAIN(x) ([(x) retain]) #define SAFE_ARC_RELEASE(x) ([(x) release]) #define SAFE_ARC_AUTORELEASE(x) ([(x) autorelease]) #define SAFE_ARC_BLOCK_COPY(x) (Block_copy(x)) #define SAFE_ARC_BLOCK_RELEASE(x) (Block_release(x)) #define SAFE_ARC_SUPER_DEALLOC() ([super dealloc]) #define SAFE_ARC_AUTORELEASE_POOL_START() NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; #define SAFE_ARC_AUTORELEASE_POOL_END() [pool release]; #endif
查看全文
相关阅读:
【移动安全基础篇】——30、class.dex文件格式讲解
【移动安全基础篇】——29、Android源码定制添加反反调试机制
【移动安全基础篇】——28、Apk加固
【移动安全基础篇】——27、常用调试检测方法与过检测方法
【移动安全基础篇】——26、两个简单app破解
粒子特效优化
android studio生成aar包
AndroidManifest
声音
unity webview
原文地址:https://www.cnblogs.com/javawebsoa/p/2458446.html
最新文章
[做题笔记] 浅谈状压dp在图计数问题上的应用
[2017 山东一轮集训 Day7] 逆序对
CF1466H Finding satisfactory solutions
CF1470E Strange Permutation
CF1474F 1 2 3 4 ...
git-bash下composer命令无法使用的问题
composer require 指定版本
composer文件中手动新增内容插件后必须执行命令composer dump-autoload
从零开始理解 Laravel 的设计哲学
API 系列
热门文章
laravel 设置定时任务(任务调度)
laravel paginate 在写api时的妙用
app与php后台接口登录认证、验证(seesion和token)
php中Session的原理
数组的并集、交集、差集array_intersect() 和 array_diff() array_merge()函数
Docker Remote API 未授权访问
65、未授权访问的TIPS
【移动安全基础篇】——33、Android加壳原理
【移动安全基础篇】——32、Android动态代码自修改实现
【移动安全基础篇】——31、Android动态代码自修改原理
Copyright © 2011-2022 走看看