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

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 dynamically 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?

Related

How to protect unity assembly without compiling to IL2CPP? [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I release a bunch of tools for free, but recently I have began to sell an application, that has private research, and people have been able to get my source code, and one person publically released my entire source. I spent a lot of time on this program, just to have someone crack it, and release my entire source.
How can I go about protecting my program? I have tried HWID, but people are still able to crack it. I know I am limited by C#, but it the most convenient to use. I just need a way to protect my programs from people trying to do this.
You could have a look at the many obfuscation tools that are out there, for example these:
http://gapotchenko.com/eazfuscator.net
http://orangeheap.blogspot.nl
http://confuser.codeplex.com (succeeded by https://yck1509.github.io/ConfuserEx/ and then again by https://github.com/XenocodeRCE/neo-ConfuserEx)
http://ntoolbox.com)
Well, the problem with languages like C#/Java is that they are generally much easier to de-obfuscate. The way to secure this is generally to put this stuff into a webservice, but you said you couldn't really do that. What about porting specific non-trivial functions over to a language like C, and obfuscate that. Your C# program could then use reflection to make calls to this external/unmanaged dll. It would increase the difficulty for de-obfuscating, but the problem is that if someone wants it bad enough, they can figure it out as it is client-side.
It may be that legal action is the only real solution here, but this is not a site for legal advice, and I am not qualified to give it if it were.
Additionally, this could be a business decision. Consider Making your software open-source and post a donation link. I am also not qualified to give business advice, but this is worth considering. It may actually increase your revenue, not to mention the other benefits that come with releasing open-source software.
There's Dotfuscator (http://www.preemptive.com/products/dotfuscator/overview). But the best solution in some cases is to offer what you do as a web site (Software as a Service).
Consider this tool for example to convert VB to C#: http://converter.telerik.com/
Or this tool to format JSON: http://jsonformatter.curiousconcept.com/
This may or may not work for you. I don't know what the nature of the software you're trying to protect is.
No, your code needs to contain the information needed to decrypt itself, its an impossible problem to solve.
Your best solution is to put your intellectual property on a server in the cloud that only you have access to. Give your customers a unique login, audit their access to check for abuse, off load as much grunt work onto your customers machines, but keep your algorithms locked into the cloud.

What effect does Swift's lack of dynamic capabilities have when developing? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am CS student relatively new to Cocoa/CocoaTouch and I am trying to understand the nature of OS X/iOS dev. I understand the difference between dynamic and static languages.
Static languages have all variables bound to a type etc. Variables are bound during execution for dynamic etc.
However, when I am developing OS X apps I struggle to see the examples where dynamic functionality would change things? Can someone explain what someone explain what Obj-C can support that Swift fundamentally cannot when developing apps?
I have come across many cases where the lack of flexibility has forced me to refactor my code, but that's not what I am talking about, or am I confused?
Can someone explain what someone explain what Obj-C can support that Swift fundamentally cannot when developing apps
What I used to take advantage of in Objective-C was not so much dynamic typing as dynamic messaging. The whole messaging apparatus can be rejiggered at runtime, from simple key-value coding or performSelector to dynamic injection of methods into a class at runtime, method swizzling, and key-value observing.
You can do all those things in Swift, but only provided you are talking to Objective-C (i.e. this is an NSObject). That's because all of those things are actually done in Objective-C. You could not, for example, implement even the most basic key-value coding in pure Swift, in the absence of Foundation, as Swift has neither dynamic messaging nor true introspection.
From the point of view of practical app programming, however, I don't miss any of that. For one thing, I am always talking to Objective-C, because Cocoa is in Objective-C. For another thing, it turns out that most of these tricks weren't really necessary, and I've mostly found other ways to accomplish my practical goals. I do still use some key-value coding (especially to do tricks like store an arbitrary value inside a CALayer), but on the whole I've cut way back on my use of such stuff, mostly thanks to the fact that functions are first-class citizens in Swift.
As for dynamic typing, I don't miss it for an instant; changing to Swift has actually saved me from mistakes that I was making without even realizing it because of dynamic typing imposed on me by the APIs (e.g. the fact that objectAtIndex: returned an id — though, to be sure, this is less likely to trouble you today thanks to "lightweight generics").

Why are the scala docs missing methods? [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 5 years ago.
Improve this question
I have been trying to learn scala. One thing that I have noticed is the quality of the docs. They seem to miss out on a lot of methods. Is this intentional? I feel like I am missing something because they can't be this bad.
For example:
Blog post on reading files with scala. The blog post recommends using a scala.io.Source.fromFile(..) method to read a file. It provides an iterator. Looks very nice to use. I want to get a better understanding of the class, so I go to the scala docs on scala.io.Source.
No where in the docs does it show the method for scala.io.Source.fromFile(..). When I go to my IDE, it does try to autocomplete Source.fromFile(..), and it even works in the code.
This happened to me before when I was trying to use scala's database api. Am I missing something? Is there a secret button that pulls up this method? Have I gone my whole life being blind without realizing it? Or are the scaladocs really this bad?
fromFile is not a method of class Source, it's a method of object Source. I.e. you can't write
val source: Source = ...
source.fromFile(...)
You are looking at the documentation for the class, which doesn't list the object's methods.
The link to the object's documentation is the circle with C near the class name at the top.

best practices for cocoa touch static library [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm planning to do my next project using cocoa touch static library. My target is to separate my model entirely from my main project. ( so it does all the data communication between server and provide data to my main project). so that I can reuse the library in future if there's any iphone version.
I want my framework to behave like ios standard frameworks so that no one else using my framework should not be able to play with framework and misuse it. Specially they should not be able to override data which is given by my framework and do any kind of data manipulation.(protecting encapsulation)
I want to know that are the best practises of writing a this kind of static library?
From a language perspective you will want to carefully consider what is public method/member and what is private.
For all things private move them into the interface declaration inside your .m file:
#interface MyClass()
# Variables and Messages declared here are private.
#end
Then make a single header file which is exposed to your users with all public messages and properties.
When you do this be particularly careful that you document expectations of your users.
Nothing will break encapsulation faster than expecting a capability / variable and not being able to see how to get it in the docs / header.
Please refer what is said in the below links, this helped me design a better library.
Component-based Development Process
Software Component Specification
Using Design by Contract

If you read an LGPL projects source code and that inspires an entirely different implementation, is that work still a derived work? [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
I really want to use PGM for an application that I'm working on for one my companies. That application will never be distributed, it's for internal use only. There is an implementation called OpenPGM and a (I believe) derivative work javapgm that implements the protocol. Both are licensed under the LGPL.
My question is if I read the source code for these libraries and use that knowledge to help create an Erlang PGM implementation, would that be considered a derived work? I would prefer to release my implementation under the BSD license, so I'm not trying to take something for nothing, but I want to play fair.
In short then:
Would / should my version be released under the LGPL?
If my company is using it internally only, would there be any restrictions on how it could use that library? (it would never be distributed outside the company).
Is it in the spirit of the LGPL license to do what I want to do?
Thanks in advance! :)
I don't think it would be a derived work unless there is a 1:1 correlation between lines of code in your thing and the open source code. We're not talking about a patent here, where the concept of the invention is important.
If it is only used internally then it doesn't have to be.
You could never be certain that it doesn't accidentally leak out or get shared or included in another project.
You should try to work with OpenPGM to make the Erlang interface that you need; then it is open source, other people may help maintain it for you, you get a free code review