セルが削除できないときはセクションごと削除する
環境
Xcode9.2
iOS11.0
Swift4
エラー内容
TableView内のセクション下の1つのセルを削除しようとした時にエラーが発生
イメージは下記サイトのトップの画像
UITableViewの行削除でセクション数が減るとクラッシュする - kaz29
以下解決した方法を載せます
エラーコード
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { let deleteButton: UITableViewRowAction = UITableViewRowAction(style: .normal, title: "削除") { (action, index) -> Void in self.array.remove(at: indexPath.section) tableView.deleteRows(at: [indexPath], with: .automatic) //エラー } deleteButton.backgroundColor = UIColor.red return [deleteButton] }
エラーメッセージ
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the table view after the update (1) must be equal to the number of sections contained in the table view before the update (2), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted).'
原因
セルを削除するとnilのcellを持つセクションになるため落ちるみたい?
解決策
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { let deleteButton: UITableViewRowAction = UITableViewRowAction(style: .normal, title: "削除") { (action, index) -> Void in self.array.remove(at: indexPath.section) //セクションごと削除 //セルを削除するとnilのcellを持つセクションになるため落ちるみたい let indexSet = NSMutableIndexSet() indexSet.add(indexPath.section) tableView.deleteSections(indexSet as IndexSet, with: UITableViewRowAnimation.automatic ) print("削除しました。\(self.array)") } deleteButton.backgroundColor = UIColor.red return [deleteButton] }
is busy: Preparing debugger support for [name]の解決方法
エラーの原因
実機とのペアリングが処理がうまくいっていない?
環境
XCode 9.2
iOS 10.2
解決策
A.iPhoneの再起動
B.ペアリングを外す
1.Xcodeのメニューの「Window - Devices and Simulators」を選択
2. 対象のデバイスを右クリック「Unpair Device」を選択
3.対象の実機をコードから外してMacにつなぎ直す。
C.Xcodeを再起動してその他処理中のアプリケーションを落とす
D.素直に待つ
WARNING ITMS-90704の解決方法
WARNING ITMS-90704 エラー発生
WARNING ITMS-90704: "Missing App Store Icon. iOS Apps must include a 1024x1024px App Store Icon in PNG format. Without providing the icon in the Asset Catalog or via iTunes Connect, apps cannot be submitted for App Review or Beta App Review. Refer to https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/ for more information."
原因
iOS Apps must include a 1024x1024px App Store Icon
App Storeのアイコンにする1024x1024pxの画像を入れていないこと
解決方法
Assets.xcassetsの中の「App Stpre iOS 1024px」に1024x1024px の画像を入れる
新たな発表が!サーバーサイドの次はドローン
先日WWDC2017で大きな発表がありました!
WWDCとはWorldwide Developers Conferenceの略称で、アップルが毎年開催している開発者向けイベントの事です。
公式HP(英文)
www.macrumors.com
なんとSwift Playgroundsの次のバージョンでロボットや楽器、そしてドローンを使用したコーディングができるようになるみたいです!
これはすごいですよ、、、
詳しくはまた後で書きます!
挫折をなくせるのでは?「勉強法」 TechCamp 体験談1週間経過
- 受講して1週間経ちました。
- TECH::CAMPとは?
- Webアプリケーションコースとは?
- そもそもWebアプリケーションって何?
- 学生は学割がきく!
- なんといっても安心の1週間無条件「全額返金」保証
- 全くの未経験から必要なスキルを全て学ぶことができます。とは言っているけど、、、
- 私の今
- 有料の学習プログラムを受ける利点は早さ
- スキルを身につけるための4つのコツ
- 必要な知識のみを絞って力をつけること
- スキルを身につけるための4つのコツ
- めちゃくちゃ楽しい
- でも行き詰ることも・・・
- ネットからの勉強法※科学的根拠有
- ざっくり勉強=>パソコンで!しっかり記憶=>ノートをとる!
- まとめ
受講して1週間経ちました。
今テックキャンプのWebアプリケーションコース、オンラインコースを受けているのですがかなり良い!!!
毎日が楽しくて楽しくて仕方ないです笑