You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[anyone apc_willGet:@"key"bindWithBlock:^(id_apc_t instance, id value) {
///Before getter of property called.
}];
属性后触事务.
[anyone apc_didSet:@"key"bindWithBlock:^(id_apc_t instance, id value) {
///After setter of property called.
}];
属性条件事务.
[anyone apc_set:@"key"bindUserCondition:^BOOL(id_apc_t instance, id value) {
///Your condition when setter called...
} withBlock:^(id_apc_t instance, id value) {
///If your condition has been triggered.
}];
测试表明 : 在及其大量的多线程访问中,绑定/解绑实例属性钩子的同时访问这个属性有非常小的概率产生异常: 'Attempt to use unknown class.'。这是由于object_setClass()还没有执行完的时候访问了实例对象。该问题除了进行同步没有办法解决。项目中已经钩住了runtimelock,使用它会影响效率,所以推荐下列的可靠的方案来解决多线程的问题: