开发者

Objective-C Block Property Defined as Copy Not Working

I am seeing some 开发者_Python百科strange behavior with Objective-C blocks in a large project. Everywhere that there is a Block property that is defined as copy, there is a crash when the app attempts to reference the property later on. Overriding the setter implementation from the @synthesize'd implementation and explicitly calling Block_copy() does the trick, but interestingly when the same code is used in another project context the properties work as expected.

This must be some kind of project setting or dependency issue. Anyone run into this sort of thing before?


Thank you Bavarious. The underlying issue is libSystem library linked into the app.

The fix is to remove "-weak_library /usr/lib/libSystem.B.dylib" from the target's Linker Flags and replace it with "-weak-lSystem".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜