I m currently running into complete frustrations as i can't find any error, but my ActionSheet crashes on iPad but works well on iPhone here is the code of the action
if (view.annotation.title as String!) == "San Francisco" {
currentLat = 37.615223
currentLong = -122.389977
url = "www.google.de"
let action:UIActionSheet = UIActionSheet(title: "Change Map Type", delegate: self, cancelButtonTitle: "Back", destructiveButtonTitle: nil, otherButtonTitles: "Product Page", "Video")
action.showInView(self.view)
action.tag = 0
VideoID = "XXXXXX"
}
So the action that should be handled is
if actionSheet.tag == 0{
if buttonIndex == 1{ performSegueWithIdentifier("showShop", sender: self) }
if buttonIndex == 2{ UIApplication.sharedApplication().openURL(NSURL(string: "http://www.youtube.com/watch?v=\(youtubeVideoID)")) }
//if buttonIndex == 2{ performSegueWithIdentifier("showYoutube", sender: self) }
}
The Youtube one works fine, on iPhone and iPad, the "showShop" does work fine on iPhone but not on iPad
The "showShop" Segue forward to my ViewControllerShopView that looks like
import UIKit
class ViewControllerShopView: UIViewController {
/* ################################################## IBOutlets ################################################## */
@IBOutlet weak var activity3: UIActivityIndicatorView!
@IBOutlet weak var webView: UIWebView!
/* ################################################## viewDidLoad ################################################## */
override func viewDidLoad() {
super.viewDidLoad()
loadurl()
}
/* ################################################## didReceiveMemoryWarning ################################################## */
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
println("memory warning")
}
/* ################################################## viewWillAppear ################################################## */
override func viewWillAppear(animated: Bool) {
loadurl()
}
/* ################################################## loadurl func ################################################## */
func loadurl(){
var loadingurl = "google.com"
var homeurl = "google1.com"
loadingurl = url
let webviewURL = NSURL(string: loadingurl)
let request = NSURLRequest(URL: webviewURL)
webView.loadRequest(request)
}
/* ################################################## HomeButton ################################################## */
@IBAction func Reload(sender: AnyObject) {
var loadingurl = "google.com"
var homeurl = "google1.com"
loadingurl = url
let webviewURL = NSURL(string: loadingurl)
let request = NSURLRequest(URL: webviewURL)
webView.loadRequest(request)
}
/* ################################################## Activity Indicator ################################################## */
func webViewDidStartLoad(_ : UIWebView){activity3.startAnimating()}
func webViewDidFinishLoad(_ : UIWebView){activity3.stopAnimating()}
}
but the Segue never been done on iPad, it simply crashes on the Segue.
Anyone a idea what could be wrong?
UIActionController
instead, theUIActionSheet
andUIAlertView
are deprecated, more info about it here: developer.apple.com/library/IOs/documentation/UIKit/Reference/…, however you have not mentioned which iOS versions are affected... – FomentationUIAlertController
is a 'merged' (or 'combined' if you'd like) version ofUIActionSheet
andUIAlertView
in one class, so the end-user won't spot the difference, but under the hood (in your code) you need to handle such deprecation if your project supports both iOS7 and iO8. – FomentationUIAlertController
works totally different than the oldUIActionSheet
orUIAlertView
did. (SORRY! I mistyped the name of the class above!) – FomentationUIAlertView
orUIActionSheet
but in iOS8 you have to use theUIActionController
only. the implementation is different, you need to check which iOS version runs on the device in runtime to work with the proper classes. – Fomentation