通用链接 iOS - .xcodeproj 文件在哪里?

Universal linking iOS - where is the .xcodeproj file?

几天来我一直在努力让通用链接在 iOS 上为 React Native 工作。

文档 here 说“在 iOS 上,您需要 link RCTLinking 到您的项目”。然后我被告知去 node_modules/react-native/Libraries/LinkingIOS 并将一个 .xcodeproj 文件拖到我的项目中。

None Libraries 文件夹中的库中有 .xodeproj 个文件。

是命中注定的吗?我的 react-native 实例是否遗漏了什么?谷歌搜索这个问题根本没有解决任何问题 - 其他人的 Libraries 文件夹中是否都有 .xcodeproj 文件??

从版本 0.60 开始,React Native 提供 auto-linking。

要使库在高于 0.60 的 RN 版本中可用,您必须:

1) 将对 LinkingIOS 文件夹的引用添加到 header 搜索路径中

Xcode -> project target -> projectName ->Build Settings -> header search paths:

$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS

2) 在AppDelegate.m

中导入

#import "RCTLinkingManager.h"

关于您需要执行的其他步骤:

  • 将苹果应用网站关联文件上传到您的网络服务器,
  • 准备应用程序以在 developer.apple.com
  • 中通用 linking
  • 在Xcode和RN代码
  • 中设置通用links

你可以检查这个link:

https://www.ekreative.com/blog/universal-linking-in-react-native-for-ios/

只需忽略该页面上的手册 linking 段落。