У меня есть таблицаView, где пользователь может пронести (слева), чтобы удалить записи данных. Если пользователь проведите пальцем влево, а затем вместо нажатия на удаление (или «unswipe» right), пользователь коснитесь кнопки unindSegueButton, аварии приложения в AppDelegate.unindsegue - ошибка приложения (commitEditingStyle прерван)?
Сбой происходит в viewController, к которому я перематываю. Он полностью загружается, но потом падает. Если пользователь обязуется сначала удалить или «развязать», нет сбоя ...
Как я могу избежать этого? Могу ли я что-то сделать в prepareforsegue, чтобы отменить левый салфетки?
func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
let source = objectSample[indexPath.row].source.name
return source == "MyApp"
}
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
let source = objectSample[indexPath.row].source.name
//println(objectSample[indexPath.row].UUID)
if (editingStyle == UITableViewCellEditingStyle.Delete) && (source == "MyApp") {
let UUIDtoDelete = objectSample[indexPath.row].UUID
println("Deleted entry: \(source)")
deleteUUIDobject(UUIDtoDelete)
objectSample.removeAtIndex(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Automatic)
}else {
println("Not allowed to delete, source: \(source)")
}
}
AppDelegate
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let isOnboarded = NSUserDefaults.standardUserDefaults().boolForKey("Onboarded")
let storyboard = UIStoryboard(name: "Main", bundle: nil)
// instantiate your desired ViewController
let dashboardViewController = storyboard.instantiateViewControllerWithIdentifier("DashboardVC") as! UIViewController
let onboardingViewControllerOne = storyboard.instantiateViewControllerWithIdentifier("OnboardingVCOne") as! UIViewController
let navigationController = storyboard.instantiateViewControllerWithIdentifier("NavigationController") as! UINavigationController
if (isOnboarded) {
window!.rootViewController = navigationController
}else{
window!.rootViewController = onboardingViewControllerOne
}
return true
}
Какое сообщение об ошибке вы получаете в консоли? Вы пытались использовать контрольные точки? – Cesare
Plz выставил журнал аварий. –
@cecexx Если пользователь обязуется удалить или «unswipe» во-первых, нет аварии – KML