描述
根据基本教程,我无法运行最初的React Native应用程序。该错误似乎与UIUserInterfaceIdiomCarPlay有关。
复制步骤和示例代码
按照此处的教程https://facebook.github.io/react-native/releases/0.23/docs/tutorial.html#content
我创建了一个新的React Native项目react-native init AwesomeProject
然后进入目录,然后运行react-native run-ios
注意我也尝试过Xcode,无数修复在线,但仍然没有骰子。这是我得到的错误:
/Users/lauracressman/Desktop/AwesomeProject/node_modules/react-native/React/Base/RCTPlatform.m:26:10: error: use of undeclared identifier 'UIUserInterfaceIdiomCarPlay'; did you mean 'UIUserInterfaceIdiomPad'?
case UIUserInterfaceIdiomCarPlay:
^~~~~~~~~~~~~~~~~~~~~~~~~~~
UIUserInterfaceIdiomPad
In module 'UIKit' imported from /Users/lauracressman/Desktop/AwesomeProject/node_modules/react-native/React/Base/RCTPlatform.m:12:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:33:5: note: 'UIUserInterfaceIdiomPad' declared here
UIUserInterfaceIdiomPad NS_ENUM_AVAILABLE_IOS(3_2), // iPad style UI
^
/Users/lauracressman/Desktop/AwesomeProject/node_modules/react-native/React/Base/RCTPlatform.m:26:10: error: duplicate case value 'UIUserInterfaceIdiomPad'
case UIUserInterfaceIdiomCarPlay:
^
/Users/lauracressman/Desktop/AwesomeProject/node_modules/react-native/React/Base/RCTPlatform.m:22:10: note: previous case defined here
case UIUserInterfaceIdiomPad:
^
2 errors generated.
其他信息
React Native version:0.42.3
平台:iOS
开发操作系统:MacOS
开发工具:Xcode,命令行
答案 0 :(得分:0)
Someone最近遇到了与错误消息Use of undeclared identifier 'UIUserInterfaceIdiomCarPlay'; did you mean 'UIUserInterfaceIdiomPad'?
相同的问题。他评论了第26和第26行。来自node_modules/react-native/React/Base/RCTPlatform.m
的27,显然是让它发挥作用。它可能与使用过时版本的Xcode