【问题标题】:ios-charts: unable to import library to a new projectios-charts:无法将库导入新项目
【发布时间】:2015-09-17 12:57:12
【问题描述】:

我无法将the iOS-chart project / 库集成到自定义项目中。

这是我做的步骤:

  • 在 Xcode 上打开演示应用程序
  • 在原始演示代码中找到图表库

  • 点击在finder中显示并将项目复制到新项目中
  • 新项目现在有 2 个目标。我检查包含视图 (ChartIn) 的目标是否确实链接到库。确实如此。
  • 我编译库(在新项目中)
  • 然后我编译并运行 ChartIn,但出现以下错误:

dyld:库未加载:@rpath/Charts.framework/Charts Referenced 从: /private/var/mobile/Containers/Bundle/Application/0C7EC6DC-94B6-4205-8E71-0F704B2A7523/ChartIn.app/ChartIn 原因:找不到图片

【问题讨论】:

  • 阅读 github README,如果不确定,请搜索类似问题。我见过很多这样的。

标签: ios xcode compilation linker ios-charts


【解决方案1】:

我只能引用:

为了正确编译:

Drag the Charts.xcodeproj to your project
Go to your target's settings, hit the "+" under the "Embedded Binaries" section, and select the Charts.framework
Temporary workaround: Xcode 6.3.1 has a bug, where you have to build your project once before actually writing the @import line. So hit "Build" now!
@import Charts
When using Swift in an ObjC project:
    You need to import your Bridging Header. Usually it is "YourProject-Swift.h", so in ChartsDemo it's "ChartsDemo-Swift.h". Do not try to actually include "ChartsDemo-Swift.h" in your project :-)
    Under "Build Options", mark "Embedded Content Contains Swift Code"

如果你想为 iOS 7 编译:

Drag the code itself (.swift files) to your project. As sadly, Swift currently does not support compiling Frameworks for iOS 7.
Make sure that the files are added to the Target membership.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-10-13
    • 1970-01-01
    • 1970-01-01
    • 2016-01-25
    • 1970-01-01
    • 2018-05-29
    • 2020-12-23
    相关资源
    最近更新 更多