Is it possible to convert NSString to plain Objective C code
ios, iphone, nsstring, objective-c, xcode
Solution
What you've described isn't exactly possible. But there is support for certain things, eg, the ability to instantiate classes and invoke methods (theoretically) with strings:
`NSClassFromString` allows you to instantiate classes based on a passed string.
`NSSelectorFromString` allows you to invoke or 'call' a method based on passed string.
The string can be determined dynamically at run-time.
Based on your comments this is apparently not what you're interested in (despite the fact I think it does actually address your question). One thing you can do (it's not native Obj-C, but I think it is pertinent given some of the comments) is to inject `JavaScript` into a `UIWebView`.
Problem
For example I have ``` NSString *string = @"return sharedInstance;"; ``` I have a class method ``` + (id)sharedInstance; ``` Can I convert that string to plain code and use it in my method? This would be extremely useful for debugging. Suppose I have a method where I want to test some code (Let it be simple return values, Is it possible?) I can just write code for the method and test the new code in runtime.