动态加载目标C代码 [英] Loading Objective C code dynamically

查看:102
本文介绍了动态加载目标C代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种动态加载基于Obj C的源并在我的iOS应用程序中显示视图的可能性.例如:我编写了一组用于显示视图的代码,我想动态加载此代码并显示该视图. 诸如此类的东西

I am looking for a possibility of loading Obj C based source dynamically and show the view in my iOS application. For example: I have a set of code written for showing a view, i want to dynamically load this code and show this view. Some thing like,

  1. 我将在iOS应用程序的后台运行一项服务.
  2. 它将以文本格式从我的服务器获取一组Obj C代码
  3. 此动态Obj C代码应动态执行并显示相应的iOS视图

来自评论.未在应用商店中发布..其内部版本

From Comments Not released in the appstore.. its for internal

这可能吗?

推荐答案

简短答案:

答案不是那么简短:

理论上,您可以在项目中包含Clang编译器工具链的C或C ++接口,让该库编译您下载的代码,然后(通过NSBundle或与dlopen直接交互)编译的链接代码添加到您的应用中.

You could—in theory—include either the C, or C++ interface to the Clang compiler toolchain in your project, have that library compile the code you download, and then (through either NSBundle or direct interaction with dlopen) link that compiled code into your app.

在实践中,如果要实现的目标是提交到App Store,则条款和条件明确禁止这样做.

In practice, if what you want to achieve is submitting to the App Store, this is explicitly prohibited by the Terms and Conditions.

这篇关于动态加载目标C代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆