         //1000件取得できるようにする
         request.performRequestWithHandler { (responseData, urlResponse, error) -> Void in
             if error != nil {
+                self.presentViewController(self.createErrorAlert("ツイート検索が失敗しました。", type: .Alert), animated: true, completion: nil)
                 print("error is \(error)")
             } else {
                 let json = JSON(data: responseData)

        
        accountStore.requestAccessToAccountsWithType(accountType, options: nil) { (granted:Bool, error:NSError?) -> Void in
            if error != nil {
                print("error! \(error)")
                return
            }
            
            if !granted {
                print("error! Twitterアカウントの利用が許可されていません")
                return
            }
            
            let accounts = self.accountStore.accountsWithAccountType(accountType) as! [ACAccount]
            if accounts.count == 0 {
                print("error! 設定画面からアカウントを設定してください")
                return
            }
            self.twAccount = accounts[0]

                self.collectionView.reloadData()
            }
        }
    }
    
    func createErrorAlert(errorMessage: String, type: UIAlertControllerStyle) -> UIAlertController {
        let alert: UIAlertController = UIAlertController(title: "エラー", message: errorMessage, preferredStyle:  type)
        let defaultAction: UIAlertAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler:{
            (action: UIAlertAction!) -> Void in
        })
        alert.addAction(defaultAction)
        return alert
    }

    override func didReceiveMemoryWarning() {
