将自定义iOS插件与NativeScript合并

时间:2018-12-07 02:19:06

标签: cocoapods nativescript

我一直与NativeScript tutorial for building plugins that use CocoaPods一起关注。我在Xcode using this tutorial中创建了一个测试框架。

这是我的目录结构:

├── KnobControl
│   ├── KnobControl
│   ├── KnobControl.podspec
│   └── KnobControl.xcodeproj
├── MYCocoaPodsApp
│   ├── README.md
│   ├── app
│   ├── hooks
│   ├── node_modules
│   ├── package-lock.json
│   ├── package.json
│   ├── platforms
│   │   └── ios
│   │       ├── MYCocoaPodsApp
│   │       ├── MYCocoaPodsApp.xcodeproj
│   │       └── Podfile
│   └── webpack.config.js
└── my-plugin
    ├── package.json
    └── platforms
        └── ios
            └── Podfile

这是KnobControl/KnobControl.podspec

中的内容
Pod::Spec.new do |spec|
    spec.name          = "KnobControl"
    spec.version       = "1.0.0"
    spec.summary       = "A knob control like UISlider, but in circular form"
    spec.description   = "The knob control is a completely customizable widget that can be used in any iOS app. It also plays a little victory fanfare."
    spec.homepage      = "http://raywenderlich.com"
    spec.license       = "MIT"
    spec.author        = { "Me" => "my@email.address" }
    spec.platform      = :ios, "12.1"
    spec.source        = { :path => '.' }
    spec.source_files  = "KnobControl"
    spec.swift_version = "4.2"
end

my-plugin/platforms/ios/Podfile中是什么:

platform :ios, '12.1'
pod 'KnobControl', :path => '../../../KnobControl'

在运行MYCocoaPodsApp/platforms/ios/Podfile之后,tns-build ios中的内容如下:

use_frameworks!

target "MYCocoaPodsApp" do
# Begin Podfile - /MYCocoaPodsApp/node_modules/my-plugin/platforms/ios/Podfile
platform :ios, '12.1'
pod 'KnobControl', :path => '../../../KnobControl'

# End Podfile
end

运行tns build ios时出现以下错误:

Building project...
Xcode build...
warning: The i386 architecture is deprecated for your deployment target (iOS 12.1). You should update your ARCHS build setting to remove the i386 architecture. (in target 'KnobControl')
warning: The i386 architecture is deprecated for your deployment target (iOS 12.1). You should update your ARCHS build setting to remove the i386 architecture. (in target 'Pods-MYCocoaPodsApp')
<unknown>:0: error: iOS 12 does not support 32-bit programs
Command CompileSwiftSources failed with a nonzero exit code
note: Using new build systemnote: Planning buildnote: Constructing build description
** BUILD FAILED **

Command xcodebuild failed with exit code 65

要使它正常工作,我需要做什么?

0 个答案:

没有答案