我一直与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
要使它正常工作,我需要做什么?