小编Kar*_*mar的帖子

斯威夫特 - prepareForSegue不工作

我有三个数组来制作tableView和第二个ViewController.一个显示tableView上每个部分的标题,一个显示标题,一个具有每个单元格的链接.当我构建并点击其中一个单元格时,我得到:

致命错误:在展开Optional值时意外发现nil

在这条线上:

 let url = URL(string: websiteURL)!
Run Code Online (Sandbox Code Playgroud)

现在我相信这是因为我的prepareForSegue无效,这意味着它不会将数组数据发送到第二个View Controller(ChannelViewController).我还测试了这个,补充说

print("hello")
Run Code Online (Sandbox Code Playgroud)

prepareForSegue函数,看看调试器中是否出现"hello".但事实并非如此.

所以我猜测主要的问题是让prepareForSegue做它应该做的事情.

这是FirstViewController代码:

import UIKit




class FirstViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {



var headers = ["Bein Sports", "Sky Sports", "Alkass", "Other"]

var channels = [["Bein Sports 1","Bein Sports 2","Bein Sports 3","Bein Sports 4","Bein Sports 5","Bein Sports 6","Bein Sports 7","Bein Sports 8","Bein Sports 9","Bein Sports 10","Bein Sports News"],
                          ["Sky Sports 1","Sky Sports 2","Sky Sports 3","Sky Sports 4","Sky Sports 5"],
                          ["Alkass One", "Alkass Two", "Alkass Three", …
Run Code Online (Sandbox Code Playgroud)

arrays xcode uitableview ios swift

2
推荐指数
1
解决办法
3103
查看次数

xcrun:错误:无法找到 SDK“iphoneos”

我没有经验,所以我无法确定问题出在哪里。谢谢您的帮助。

我克隆了这个 repo:https : //github.com/flatlogic/react-native-starter.git

并试图按照以下步骤操作:

克隆回购

git 克隆https://github.com/flatlogic/react-native-starter.git

导航到克隆文件夹并安装依赖项

cd react-native-starter && yarn install

安装 Pod

cd ios && pod 安装

当我到达 pod install 时,我收到了那个错误。


karar@Karars-MacBook-Air ios % pod install
Auto-linking React Native modules for target `ReactNativeStarter`: BVLinearGradient, RNCMaskedView, RNGestureHandler, RNLocalize, RNReanimated, RNScreens, RNVectorIcons, ReactNativeUiLib, react-native-safe-area-context, and toolbar-android
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Downloading dependencies
Installing BVLinearGradient (2.5.6)
Installing DoubleConversion (1.1.6)
Installing …
Run Code Online (Sandbox Code Playgroud)

sdk cocoapods react-native

2
推荐指数
3
解决办法
105
查看次数

标签 统计

arrays ×1

cocoapods ×1

ios ×1

react-native ×1

sdk ×1

swift ×1

uitableview ×1

xcode ×1