首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将Vuforia iOS框架纳入离子工程

如何将Vuforia iOS框架纳入离子工程
EN

Stack Overflow用户
提问于 2022-02-21 08:52:33
回答 1查看 104关注 0票数 0

我想将Vuforia提供的示例xcode项目功能包含在一个离子项目中。示例项目可以从这里下载:https://developer.vuforia.com/downloads/samples

独立项目运行良好,我能够调整它以满足我对功能的期望。

当我试图将它集成到我的主要项目中时,问题就开始了,这个项目使用了离子框架。

基本上,这个项目的运作方式如下:

I在离子的webview

  • There's a按钮中有一个应用程序,它导致AR functionality

  • I实现了一个电容插件来启动使用Vuforia

的原生视图

我完成了Android版本,所以它超出了范围。

示例XCode项目向构建阶段添加了一堆内容,以便嵌入VuforiaEngine.framework和链接,编译C++源代码以连接Swift源代码和框架

第一个问题:离子项目将CocoaPods用于XCode项目,因此即使我设置了"App“项目(构建阶段)中的所有内容,工作区设置也忽略了它。如果我构建App,它不能导入Pods,如果我构建Pods项目,它没有必要的设置。

接下来,我尝试创建一个自定义Pod来包含框架,添加必要的设置并导入它。

首先,它是有希望的,但过了一会儿,我遇到了奇怪的错误消息,我不知道如何使它工作。

下面是示例项目中的一些设置

正如您所看到的,有几个框架必须链接,有一个嵌入式框架是由Vuforia在SDK中提供的,还有一堆c++文件和头文件要包括在内。

这是我的.podspec尝试

代码语言:javascript
复制
Pod::Spec.new do |s|
  s.name             = 'Vuforia'
  s.version          = '0.1.0'
  s.summary          = 'Vuforia library.'

  s.homepage         = 'https://github.com/7681268/vuforia'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { '7681268' => '<OMITTED>@gmail.com' }
  s.source           = { :git => '<OMITTED>/vuforia/ios/pod', :tag => '0.1.0' }

  s.swift_version = '5'

  s.ios.deployment_target = '13.0'

  s.source_files = 'vuforia/Classes/**/*'

  s.library = 'c++'
  s.xcconfig = {
      #  'CLANG_CXX_LANGUAGE_STANDARD' => 'c++11',
      #  'CLANG_CXX_LIBRARY' => 'libc++',
       'HEADER_SEARCH_PATHS' => '$(inherited) "vuforia/CrossPlatform"',
       'CLANG_ENABLE_MODULES' => 'YES',
       'ENABLE_BITCODE' => 'NO'
  }

  s.resource_bundles = {
    'vuforia' => ['vuforia/Assets/*']
  }

  s.vendored_frameworks = 'VuforiaEngine.framework'
  s.frameworks = 'Foundation', 'QuartzCore', 'CoreMedia', 'MediaPlayer', 'VuforiaEngine', 'UIKit', 'AudioToolbox', 'SystemConfiguration', 'CoreMotion', 'CoreGraphics',  'CoreFoundation', 'Security', 'AVFoundation','Metal'
  s.public_header_files = 'vuforia/Classes/**/*.h'
end

文件:

代码语言:javascript
复制
<POD ROOT>
  +_pods.xcodeproj
  +Example
  -vuforia
    +Assets (contains the models, textures, vuforia database)
    +Classes (some swift code for the UI, and a C++ wrapper)
    +CrossPlatform (Contains the crossplatform c++ bridge between the sample and the framework)
  +VuforiaEngine.framework (Framework provided by Vuforia)
  Vuforia.podspec

在整理完这个项目之后,我得到了来自于Fundation框架的错误消息。

编辑:这个部分已经通过将VuforiaWrapper.cpp重命名为'.mm‘扩展来解决

代码语言:javascript
复制
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:523:1: error: expected unqualified-id
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:525:9: error: unknown type name 'NSString'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:526:9: error: unknown type name 'NSString'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:528:19: error: unknown type name 'NSString'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:529:44: error: unknown type name 'NSString'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:531:19: error: unknown type name 'NSString'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:532:53: error: unknown type name 'NSString'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:534:19: error: unknown type name 'NSString'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:534:50: error: unknown type name 'Protocol'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:535:19: error: unknown type name 'Protocol'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:535:61: error: unknown type name 'NSString'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:539:30: error: unknown type name 'NSString'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:539:53: error: format argument not an NSString
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:540:31: error: unknown type name 'NSString'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:540:63: error: format argument not an NSString
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSZone.h:9:1: error: expected unqualified-id
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSZone.h:19:63: error: unknown type name 'NSString'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSZone.h:20:19: error: unknown type name 'NSString'
- ERROR | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:10:1: error: expected unqualified-id
- NOTE  | xcodebuild:  fatal error: too many errors emitted, stopping now [-ferror-limit=]

错误起源于VuforiaWrapper.h文件,该文件包含以下一行:

代码语言:javascript
复制
#import <Foundation/Foundation.h>

问题

是否有任何解决方案可以手动将这些设置包括在CocoaPods工作区中(就像我在没有CocoaPods的新项目prom划痕中所做的那样)?

如果没有,如何正确配置podspec以实现相同的目标?

还有其他/更好的办法吗?

注意:我正在寻找最简单的解决方案,但可以为未来提出更健壮的方法。另外,我不打算出版这个吊舱,我只是想让它在我的项目中发挥作用

Xcode版本:13.2.1

操作系统:macOS Big Sur 11.6.3

EN

回答 1

Stack Overflow用户

发布于 2022-02-21 11:17:53

据我所知,Ionic是与Cordova集成的,所以可以尝试使用plugin:https://www.npmjs.com/package/cordova-plugin-vuforia-sdk

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71203491

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档