在iOS的今日扩展中导入不起作用

3

我正在尝试将一些库导入到今天扩展中(在主应用程序中正常工作)。当我运行应用程序时,出现以下错误:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_Budget", referenced from:
      objc-class-ref in TodayViewController.o
  "_OBJC_CLASS_$_JBBarChartView", referenced from:
      objc-class-ref in TodayViewController.o
  "_OBJC_CLASS_$_Users", referenced from:
      objc-class-ref in TodayViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

以下是导入内容:

#import "JBBarChartView.h"
#import "JBChartView.h"
#import "Users.h"
#import "Budget.h"

有什么建议吗?

3
选择文件,在文件检查器中将目标设置为今天的扩展目标,以使文件可供目标使用。 - Sandeep
@insane-36,目标成员区域为灰色,您知道是为什么吗? - spogebob92
忽略我。.m文件...不是实现文件。 - spogebob92
好的,我已经解决了目标成员的问题,但现在我收到了20多个“解析错误”的文件,这些文件以前都很正常。 - spogebob92
1
如果你遇到解析错误,那就意味着出现了一些错误。解决这个错误。 - Sandeep
显示剩余2条评论
1个回答

0

如果你使用了pods并且导入了一些库,你可以像这样编辑Podfile:

target 'MyApp' do
  pod 'GoogleAnalytics', '~> 3.1'

  # Has its own copy of OCMock
  # and has access to GoogleAnalytics via the app
  # that hosts the today target

  target 'MyAppToday' do
    inherit! :search_paths
    pod 'OCMock', '~> 2.0.1'
  end
end

如果您想使用自己的类,请单击此文件并检查目标成员资格。您还可以将这些文件打包为框架。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接