- 投稿日:2019-02-09T19:45:27+09:00
高品質なSwiftチュートリアルのパート2の翻訳が終わりました
自己サイトの宣伝です。
良質なiOSチュートリアルを提供しているraywenderlich.comから、SpriteKitを使ったゲームチュートリアルの翻訳をしています。
パート2の翻訳が終わりましたのでその報告です。全部でパート3まであり、パート3を残すのみとなりました。
本当に高品質なチュートリアルなので、勉強会とかに使ってもらえたら嬉しいです。
自由にHTMLもっていってもらって構いません。
https://www.doumeishi.me/raywenderlich.com/
- 投稿日:2019-02-09T18:34:52+09:00
ipadでcapturePhoto時にcrashする問題の解決
背景
今回初めてアプリ申請した際にrejectの洗礼を受けてしまったので記事にしてみたいと思います。
reject内容
Your app crashed on iPad running iOS 12.1.3 on WiFi when we tapped to take a photo.
自分はipadPro(10.5inch)とiphoneXS Maxとiphone6sを所持していてそれらで実機テストしているのですがipadないので早速困りました笑
幸いcrashlogの方が送られてきていたので以下の記事を参考させてもらいに解析しました
https://qiita.com/ruwatana/items/cc470eb229d267d693b0crashlogLast Exception Backtrace: 0 CoreFoundation 0x1a2ae9ea4 __exceptionPreprocess + 228 1 libobjc.A.dylib 0x1a1cb9a50 objc_exception_throw + 55 2 AVFoundation 0x1a8c82b48 -[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] + 751 3 camera 0x1041f4120 0x1041ec000 + 33056やはりAVCaputurePhotoOutputが怪しい事が分かったので調べると以下の記事を発見https://qiita.com/jumperson/items/1f47e91f2fec80654b09
どうやらiPadではFlashが使えずAVCapturePhotoSettingsのflashModeをautoにしていたらcrashしてしまうとのこと。解決方法
カメラ起動時にFlashをサポートしていない端末の場合はFlashをoffにすることで解決
viewDidLoad()//flashサポートしてるかの確認 let device = AVCaptureDevice.default( AVCaptureDevice.DeviceType.builtInWideAngleCamera, for: AVMediaType.video, // ビデオ入力 position: AVCaptureDevice.Position.back) if !device!.hasFlash{ let captureSetting = AVCapturePhotoSettings() captureSetting.flashMode = .off }審査通るといいですがまた別の問題でrejectくらいそうです笑
- 投稿日:2019-02-09T13:54:53+09:00
質問です。
SwiftでtableView使ってアプリを作成しようとしている者です。
以下のコードを書いた後、DataSourceとDelegeteを設定してTableViewに値をセットしようとしたら、
Signal SIGABRTが出てしまいました。
どうしたら解決できますか?
教えてください。import UIKit
class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource{
@IBOutlet weak var tableView: UITableView! let places = ["yuy","ii","i","j"] override func viewDidLoad() { super.viewDidLoad() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return places.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell: UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "placeCell", for: indexPath) cell.textLabel!.text = places[indexPath.row] return cell }}