开发者

Objective-C runtime reflection (objc_msgSend): does it violate the iPhone Developer License Agreement? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question does not appear to be about programming within the scope defined in the help center.

Closed 7 years ago.

Improve this question

Does code like this (potentially) violate the iPhone Developer License Agreement?

Class clazz = NSClassFromString(@"WNEntity");
id entity = [clazz entityWithImage:@"Icon.png"];
SEL setPositionSelector = NSSelectorFromString(@"setPosition:");
objc_msgSend(entity, setPositionSelector, CGPointMake(200, 100));

I'm working on code that d开发者_开发百科ynamically allocates classes from XML and calls methods on them via objc_msgSend. It's just very convenient constructing my objects that way but it worries me because i have no idea whether this is ok or violates the License by dynamically executing code or maybe even calling private (?) API functions. They wouldn't be documented if they were private, right?

Can someone shed some light on this? Have you had an App approved or rejected using code similar to the above?

I'm pretty sure that this is ok but i wan't to hear it from someone else! :)


If the method you're calling is documented, you're not violating the agreement. There's nothing wrong with using objc_msgSend(), because these "reflection" functions are fully documented.


You need to use a similar structure in order to support different versions of iOS (or a "universal" app that works on iPhone and iPad) so it should be fine.

One point, though: I'm not sure that you need to directly use objc_msgSend. Could you not use performSelector:withObject:afterDelay: or one of the other, similar methods of NSObject?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜