IBM Worklight 6.1 - 如何从Eclipse向Xcode添加自定义编写的本机代码? [英] IBM Worklight 6.1 - How to add custom written native code from Eclipse to Xcode?

查看:138
本文介绍了IBM Worklight 6.1 - 如何从Eclipse向Xcode添加自定义编写的本机代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Iphone 5s上创建了一个混合应用程序。 worklight服务器版本为6.1,Xcode版本为5.0.2。我们注意到在我们删除了Iphone下的原生文件夹之后,我们自编的本机代码就消失了。因此,当我们从Eclipse构建Xcode项目时,我们需要手动将这些本机代码添加到Xcode中。我只是想知道是否有更方便的方法来做到这一点?

We created a hybrid application on Iphone 5s. The worklight server version is 6.1, Xcode version is 5.0.2. We noticed that after we deleted our native folder under Iphone, our self-written native codes were gone. Therefore, we need to manually add these native codes to Xcode when we build a Xcode project from Eclipse. I am just wondering if there is a more convenient way to do it?

非常感谢。

推荐答案

如果删除本机文件夹,然后您删除的任何用户文件也将被删除。删除本机文件夹后再次构建应用程序时,Worklight只能重新生成Worklight文件,而不能重新生成用户文件......

If you delete the native folder, then any user-files you've placed in it will be deleted as well. When building the application again after deleting the native folder Worklight can only re-generate the Worklight-files, not user-files...

您的文件是您的责任。

想法:


  1. 你可以将类文件(.m和.h文件)放在 iphone \\\
    ativeResoures \Classes
    文件夹中(创建此文件夹)。现在,每次在Worklight Studio中构建时,类文件都将从 iphone \ nativeResources \Classes 文件夹复制到 iphone \ native \类文件夹。所以这是一种备份,如果您删除本机文件夹。

  1. You can place the class files (the .m and .h files) in the iphone\nativeResoures\Classes folder (create this Classes folder). Now upon every build in Worklight Studio the class files will be copied from the iphone\nativeResources\Classes folder to the iphone\native\Classes folder. So this is a sort of a back-up in case you delete the native folder.

但请注意!通过nativeResources复制或手动将类文件放在Eclipse中的 iphone \ native \Classes 文件夹中,是不够的。 Eclipse不知道如何在Xcode项目中引用您的类文件。这是您必须在Xcode 中执行的操作,以便在项目的.pbxproj文件中引用它们。

But note! Copying via nativeResources or manually placing the class files in the iphone\native\Classes folder in Eclipse, is not enough. Eclipse does not know how to reference your class files in the Xcode project. This is something you must do in Xcode so that they will be referenced in the project's .pbxproj file.

Eclipse无法为您执行此操作我不建议手动进行这种引用。

Eclipse cannot do this for you and I would not recommend on doing this referencing manually.

这也解释了中//www-01.ibm.com/software/mobile-solutions/worklight/library/\"rel =nofollow> IBM Worklight入门培训资料

This is also explained in the "Adding native functionality to hybrid application with Apache Cordova plugin" training module provided in the IBM Worklight Getting Started training materials.

如果您在Mac中开发,那么您可以在构建项目后从Eclipse工作区打开.xcodeproj文件(位于本机文件夹中);这意味着您在Xcode中所做的任何更改都将成为Eclipse项目的一部分(因为您正在处理相同的文件)...所以这也是一种简化开发的方法。

If you develop in Mac, then you can open the .xcodeproj file (located in the native folder) from the Eclipse workspace after you build the project; this means that any changes you will do in Xcode will be part of your project in Eclipse (because you are working on the same files)... So this too is a way to ease on development.

但是如果你在使用nativeResources方法时也要小心,因为在Eclipse中构建时你将失去对Xcode的更改。

But be careful if you do this while also using the nativeResources approach, because then you will lose your changes in Xcode upon build in Eclipse.

如果您谨慎行事,可以使用这两种方法。在更改Xcode中的.m或.h文件之后,始终在Eclipse中构建之前将类文件备份到nativeResources文件夹。

You can use both of these approaches if you act carefully. Always backup your class files to the nativeResources folder before building in Eclipse after changing the .m or .h files in Xcode.

您正在使用2个IDE,因此您需要玩杂耍......

You are working with 2 IDEs, so you need to juggle...

这篇关于IBM Worklight 6.1 - 如何从Eclipse向Xcode添加自定义编写的本机代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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