没有这个模块OneSignal。

8
我有一个OneSignal模块的问题。它一直提示"No such module OneSignal",我已经通过cocoa pods安装了它,并在我的pod文件中添加了"use_frameworks!"。我真的不知道还需要配置什么才能使它正常工作。
我尝试了其他解决方案,如: 使用Xcode时出现错误"No such module",但框架确实存在

输入图像描述

输入图像描述

pod文件:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'Jaee2' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Jaee2


pod 'OneSignal', '>= 2.5.2', '< 3.0'
end

target 'OneSignalNotificationServiceExtension' do
 use_frameworks!

  pod 'OneSignal', '>= 2.5.2', '< 3.0'
end

虽然提供外部资源的链接是可以的,但最好在您的帖子中简要列出您直接尝试过的内容,以免强迫他人跟随链接才能理解您所做的事情。 - Maciej Jureczko
2个回答

5

当您在AppDelegate中导入OneSignal时,是否也看到了相同的错误? 如果没有,请确保在您的pod文件中添加了 pod 'OneSignal','>= 2.5.2','<3.0'以供OneSignalNotificationServiceExtension目标使用。因此,您的pod文件应如下所示:

target 'OneSignalNotificationServiceExtension' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for OneSignalNotificationServiceExtension
pod 'OneSignal', '>= 2.5.2', '< 3.0'

end

target 'test' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for test
pod 'OneSignal', '>= 2.5.2', '< 3.0'

end

我最初在我的 pod 文件中做了那件事,请您检查一下我的问题中的 pod 文件。 - AlmoDev
你能分享一下你遵循了哪些步骤吗?因为我按照这里提到的步骤 https://documentation.onesignal.com/docs/ios-sdk-setup 进行了操作,没有遇到任何问题。 - Ali
谢谢,我刚刚解决了这个问题,现在我又遇到了另一个问题:sharedApplication is unavailable: not available in ios app extension - Use view controller based solutions where appropriate instead。你有什么想法为什么在解决OneSignal后会出现这个问题? - AlmoDev
Cocoapods非常有用(我相信),但它们是为应用程序设计的,而不是应用程序扩展,并且最终您会失去对它们在更新期间引入的功能的控制,因此您需要更加审慎地选择使用哪个版本的库,基于它们所使用的API。因此,也许您应该尝试降级版本或设置固定版本。参考:https://dev59.com/yVwY5IYBdhLWcg3w7rr6 - Ali
你的问题解决了我的问题..因为我没有将OneSignal添加到扩展中 :))) - Mehrdad

1

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