前提・実現したいこと
絶対に挫折しないiPhoneアプリ開発超入門(7版)のChapter07と
Chapter08のプログラムを組み合わせてカメラで撮影した画像を
Twitterに投稿するプログラムを作ったのですが、実機で確認すると
アクティビティビューからTwitterを選択するとTwitterが落ちてしまう
問題が発生しました。
発生している問題・エラーメッセージ
アクティビティビューからTwitterを選択するとTwitterが落ちてしまう問題が発生。
2019-06-01 08:42:29.390379+0900 SNS[1112:225398] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles 2019-06-01 08:42:29.391394+0900 SNS[1112:225398] [MC] Reading from public effective user settings. 2019-06-01 08:42:29.402993+0900 SNS[1112:225480] [MC] Filtering mail sheet accounts for bundle ID: com.angelteatime.hijirichan.SNS, source account management: 1 2019-06-01 08:42:29.413903+0900 SNS[1112:225480] [MC] Filtering mail sheet accounts for bundle ID: com.angelteatime.hijirichan.SNS, source account management: 2 2019-06-01 08:42:42.635549+0900 SNS[1112:225398] [core] SLRemoteComposeViewController: (this may be harmless) viewServiceDidTerminateWithError: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method} 2019-06-01 08:43:33.945499+0900 SNS[1112:225398] [MC] Filtering mail sheet accounts for bundle ID: com.angelteatime.hijirichan.SNS, source account management: 1 2019-06-01 08:43:33.946569+0900 SNS[1112:225398] [MC] Filtering mail sheet accounts for bundle ID: com.angelteatime.hijirichan.SNS, source account management: 2 2019-06-01 08:43:37.100987+0900 SNS[1112:225398] [Common] _BSMachError: port cf1b; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND" 2019-06-01 08:43:40.153613+0900 SNS[1112:225398] [core] SLRemoteComposeViewController: (this may be harmless) viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted} 2019-06-01 08:43:40.153663+0900 SNS[1112:225398] viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
該当のソースコード
import UIKit class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate { @IBOutlet weak var imageView: UIImageView! @IBAction func showActivityView(_ sender: UIBarButtonItem) { let controller = UIActivityViewController(activityItems: [imageView.image!], applicationActivities: nil) self.present(controller, animated: true, completion: nil) } @IBAction func showCamera(_ sender: UIBarButtonItem) { let camera = UIImagePickerController.SourceType.camera if UIImagePickerController.isSourceTypeAvailable(camera) { let picker = UIImagePickerController() picker.sourceType = camera picker.delegate = self self.present(picker, animated: true) } } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { let image = info[UIImagePickerController.InfoKey.originalImage] as! UIImage self.imageView.image = image UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil) self.dismiss(animated: true) } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } }
試したこと
アクティビティビューからTwitterを選択する。
補足情報(FW/ツールのバージョンなど)
Xcode 10.2.1
Swift4.2。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。