可以将 Javascript 脚本化到 xcode 中吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21938687/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can Javascript be scripted into xcode?
提问by Oliver Scott-Brown
I am writing a dev tool and I have no experience with Objective-C or Xcode, currently. I am trying make it cross platform and therefore, I will be using the native programming language for each platform that it supports. I am thinking about using Javascript for the user to script in. I am wondering if Objective-C is the best language for this or are there any better options for cross platform development. Though, please bear in mind that I can use different programming languages for the different platforms supported. I am thinking about using a Python and/or Java for the supported desktop platforms including Win, Mac, Linux. And Objective-C for iPhone and iPad.
我正在编写一个开发工具,目前我没有使用 Objective-C 或 Xcode 的经验。我正在尝试使其跨平台,因此,我将为它支持的每个平台使用本机编程语言。我正在考虑为用户使用 Javascript 编写脚本。我想知道 Objective-C 是否是最好的语言,或者是否有更好的跨平台开发选项。不过,请记住,我可以为支持的不同平台使用不同的编程语言。我正在考虑将 Python 和/或 Java 用于支持的桌面平台,包括 Win、Mac、Linux。以及适用于 iPhone 和 iPad 的 Objective-C。
To summarise my question, how can I use Javascript code in Objective-C, even if that means it uses third party libs. I don't mind it, if its compiled with Objective-C or interpreted. Compiled Javascript is probably preferable for better performance. Btw I only want to use objective-c for iOS.
总结一下我的问题,我如何在 Objective-C 中使用 Javascript 代码,即使这意味着它使用第三方库。我不介意它,如果它用 Objective-C 编译或解释。为了获得更好的性能,编译的 Javascript 可能更可取。顺便说一句,我只想在 iOS 上使用 Objective-c。
回答by Nithin Michael
Did you see the links below?
你看到下面的链接了吗?
1)Using JavaScript From Objective-C
1) 使用 Objective-C 中的 JavaScript
2)Scripting with JavaScript in Cocoa
2) 在 Cocoa 中使用 JavaScript 编写脚本
I think these will help you.
我想这些会对你有所帮助。