I've been trying very hard, have looked up every similar question pertaining to this issue on StackOverflow and trying them to no avail.
class TimeLineTableViewController: UITableViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate { var timelineData = [PFObject]() required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } override func viewDidLoad() { super.viewDidLoad() self.loadData() } @IBAction func loadData(){ timelineData.removeAll(keepCapacity: false) var findTimelineData:PFQuery = PFQuery(className:"timelineMessages") findTimelineData.findObjectsInBackgroundWithBlock { (objects:[AnyObject]! , error:NSError!) -> Void in if error == nil { self.timelineData = objects.reverse() as [PFObject] //let array:NSArray = self.timelineData.reverseObjectEnumerator().allObjects // self.timelineData = array as NSMutableArray self.tableView.reloadData() } } } override func viewDidAppear(animated: Bool) { var footerView:UIView = UIView(frame: CGRectMake(0, 0, self.view.frame.size.width, 50)) self.tableView.tableFooterView = footerView var logoutButton:UIButton = UIButton.buttonWithType(UIButtonType.System) as UIButton logoutButton.frame = CGRectMake(20, 10, 50, 20) logoutButton.setTitle("Logout", forState: UIControlState.Normal) logoutButton.addTarget(self, action:"logout:", forControlEvents: UIControlEvents.TouchUpInside) footerView.addSubview(logoutButton) }
To clarify, timelineTableViewController has one class that inherits, MessageTableCell. It's also part of a project that I've integrated into Objective-C code, so it's a combination of both Swift and ObjC. I've run both projects (the swift one and the ObjC one) independently and they work fine; it's only when I try to run it together do they mess up. Any suggestions? I'm at an utter loss for this.
“Unlike subclasses in Objective-C, Swift subclasses do not inherit their superclass initializers by default.”
Automatic Initializer Inheritance
Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/tw/jEUH0.l
Since you have override the init(coder aDecoder: NSCoder)
, TimeLineTableViewController
won't have the init()
initiailzer.
You can provide an implementation of all of its superclass designated initialisers like this
override init() { super.init() } override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) } required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) }
, or just delete the implementation of init(coder aDecoder: NSCoder)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With