App crashing when trying to delete

this has something to do with firebase path variable
This commit is contained in:
Okechi Onyeje 2016-08-30 21:03:43 -04:00
parent c27a1d840f
commit ed080bf5aa
4 changed files with 225 additions and 26 deletions

View File

@ -198,12 +198,12 @@
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494253939.792373"
timestampString = "494297335.911172"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "473"
endingLineNumber = "473"
offsetFromSymbolStart = "119876">
startingLineNumber = "385"
endingLineNumber = "385"
offsetFromSymbolStart = "70940">
</Location>
<Location
shouldBeEnabled = "Yes"
@ -213,11 +213,11 @@
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494253939.792482"
timestampString = "494297335.911317"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "473"
endingLineNumber = "473"
startingLineNumber = "385"
endingLineNumber = "385"
offsetFromSymbolStart = "3537">
</Location>
</Locations>
@ -246,11 +246,11 @@
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494253939.793308"
timestampString = "494297335.91226"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "492"
endingLineNumber = "492"
startingLineNumber = "404"
endingLineNumber = "404"
offsetFromSymbolStart = "4771">
</Location>
<Location
@ -261,11 +261,11 @@
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494253939.793436"
timestampString = "494297335.912365"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "494"
endingLineNumber = "494"
startingLineNumber = "406"
endingLineNumber = "406"
offsetFromSymbolStart = "27">
</Location>
</Locations>
@ -310,11 +310,11 @@
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494253939.794662"
timestampString = "494297335.91396"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "511"
endingLineNumber = "511"
startingLineNumber = "423"
endingLineNumber = "423"
offsetFromSymbolStart = "1030">
</Location>
<Location
@ -325,11 +325,11 @@
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494253939.794796"
timestampString = "494297335.914116"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "511"
endingLineNumber = "511"
startingLineNumber = "423"
endingLineNumber = "423"
offsetFromSymbolStart = "2770">
</Location>
<Location
@ -340,11 +340,11 @@
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494253939.794888"
timestampString = "494297335.914278"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "513"
endingLineNumber = "513"
startingLineNumber = "425"
endingLineNumber = "425"
offsetFromSymbolStart = "20">
</Location>
</Locations>
@ -685,7 +685,7 @@
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/MenuPanelViewController.swift"
timestampString = "494253939.803397"
timestampString = "494297335.923076"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "137"
@ -700,7 +700,7 @@
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/MenuPanelViewController.swift"
timestampString = "494253939.803495"
timestampString = "494297335.923177"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "137"
@ -781,7 +781,7 @@
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ItemImagePickerViewController.swift"
timestampString = "494253939.80689"
timestampString = "494297335.925585"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "67"
@ -796,7 +796,7 @@
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ItemImagePickerViewController.swift"
timestampString = "494253939.807006"
timestampString = "494297335.925882"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "68"
@ -806,5 +806,132 @@
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/SettingsViewController.swift"
timestampString = "494297335.49165"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "197"
endingLineNumber = "197"
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/SettingsViewController.swift"
timestampString = "494297335.49165"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "194"
endingLineNumber = "194"
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.SettingsViewController.(tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -&gt; ()).(closure #5)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/SettingsViewController.swift"
timestampString = "494297096.965943"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "193"
endingLineNumber = "193"
offsetFromSymbolStart = "2117">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.SettingsViewController.(tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -&gt; ()).(closure #5)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/SettingsViewController.swift"
timestampString = "494297096.966065"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "193"
endingLineNumber = "193"
offsetFromSymbolStart = "5269">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.SettingsViewController.(tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -&gt; ()).(closure #5).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/SettingsViewController.swift"
timestampString = "494297096.9662"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "196"
endingLineNumber = "196"
offsetFromSymbolStart = "34">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/SettingsViewController.swift"
timestampString = "494297322.681338"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "193"
endingLineNumber = "193"
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.SettingsViewController.(tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -&gt; ()).(closure #5)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/SettingsViewController.swift"
timestampString = "494297335.927614"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "193"
endingLineNumber = "193"
offsetFromSymbolStart = "2126">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.SettingsViewController.(tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -&gt; ()).(closure #5)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/SettingsViewController.swift"
timestampString = "494297335.927765"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "193"
endingLineNumber = "193"
offsetFromSymbolStart = "5714">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -111,6 +111,8 @@ class HomeViewController: UITabBarController {
})
}else {
NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil)
}

View File

@ -9,6 +9,8 @@
import UIKit
import Locksmith
import FirebaseAuth
import FirebaseDatabase
import FirebaseStorage
class SettingsViewController: UIViewController {
@ -184,6 +186,74 @@ extension SettingsViewController: UITableViewDelegate {
//put in deletion code later
print("account deleted, add in deletion code as well as deauthorization code for any network currently authorized")
//get all listing information for current user
print((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!)
FIRDatabase.database().reference().child("Users").child((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!).observeSingleEventOfType( .Value, withBlock: {
(snapshot) -> Void in
let userDict = snapshot.value as? [String : AnyObject]
let listingDict = userDict!["user_Listings"] as? [String : AnyObject]
if listingDict != nil {
for (key, values) in listingDict! {
FIRDatabase.database().reference().child("Global_listings").child(key).removeValue()
FIRStorage.storage().referenceForURL((userDict!["image_storage"] as? String)!).child("images/\(key)").deleteWithCompletion({
(error) -> Void in
})
}
}
FIRDatabase.database().reference().child("Users").child((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!).removeValueWithCompletionBlock({
(error, ref) -> Void in
if error == nil {
FIRAuth.auth()?.currentUser?.deleteWithCompletion({
(profile) -> Void in
do{
try Locksmith.deleteDataForUserAccount((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!, inService: "vendoo")
do {
try Locksmith.deleteDataForUserAccount((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!, inService: "vendoo_oauth_ebay")
}catch {
(error)
print(error)
}
do {
try Locksmith.deleteDataForUserAccount((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!, inService: "vendoo_oauth_etsy")
}catch {
(error)
print(error)
}
do {
try Locksmith.deleteDataForUserAccount((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!, inService: "vendoo_oauth_amazon")
}catch {
(error)
print(error)
}
for key in Array(NSUserDefaults.standardUserDefaults().dictionaryRepresentation().keys) {
NSUserDefaults.standardUserDefaults().removeObjectForKey(key)
}
let vc = self.storyboard?.instantiateViewControllerWithIdentifier("SignInViewController")
self.presentViewController(vc!, animated: true, completion: nil)
}
catch{
(error)
print(error)
}
})
}
})
})
alert.dismissViewControllerAnimated(true, completion: nil)
}else{