如何构建需要CocoaPods pod的Appcelerator Titanium iOS模块

Ren*_*ené 6 xcode titanium appcelerator ios

我想建立一个需要的CocoaPods吊舱(原生的iOS模块https://cocoapods.org/pods/NearbyMessages).

我使用Titanium命令行界面创建了一个新模块:

ti create --type=module --platforms=ios ...
Run Code Online (Sandbox Code Playgroud)

我跟着从的CocoaPods(指令https://guides.cocoapods.org/using/using-cocoapods.html)创建Podfile:

platform :ios, '9.0'

target 'MyModule' do
  pod 'NearbyMessages'
end
Run Code Online (Sandbox Code Playgroud)

我将Podfile放入iOS模块目录的"iphone"目录中:

MyModule
 - LICENCE
 - README
 - assets
 - documentation
 - example
 - iphone
   - Podfile
   - ...
   - timodule.xml
   - titanium.xcconfig   
Run Code Online (Sandbox Code Playgroud)

我使用以下命令安装了pod:

pod install
Run Code Online (Sandbox Code Playgroud)

我用新创建的*.xcworkspace文件打开了XCode,并将以下行添加到titanium.xcconfig文件的末尾:

#include "Pods/Target Support Files/Pods-MyModule/Pods-MyModule.debug.xcconfig"
Run Code Online (Sandbox Code Playgroud)

但不幸的是,这会导致一些错误,例如:

  • "我的模块的头文件中找不到''Ti.Module.h'文件"
  • 在我的模块的实现文件中有几个"不能使用'super',因为它是一个根类"

我尝试了包含Pods配置文件的不同变体,但没有一个成功.

任何人都可以告诉我一个正确的XCode设置应该如何在本机iOS模块中使用NearbyMessages pod?

在此先感谢您的问候!

小智 2

需要更新 build.py 文件才能使用工作区文件。在 build_module 方法中,将 -workspace 和 -scheme 参数添加到 xcodebuild。这些行应该如下所示:

rc = os.system("xcodebuild -workspace %s.xcworkspace -scheme %s -sdk iphoneos -configuration Release" %(manifest['name'],manifest['name']))

rc = os.system("xcodebuild -workspace %s.xcworkspace -scheme %s -sdk iphonesimulator -configuration Release" %(manifest['name'],manifest['name']))

进行此更改后,python build.py应该可以成功工作。

我正要自己解决这个问题,所以可能需要更多的步骤,但这让我超越了你现在的处境。