Post

Replies

Boosts

Views

Activity

Lost Connection
I have an M1 Mac and I am on Monterey beta 4. I have Xcode 12 and whenever I try to run my iOS app on my Mac natively, I get this error message. Could not attach to pid : “4837” Lost Connection Full Log Any Ideas? Thanks in advanced
4
0
1.7k
Nov ’21
I am getting this error message
I am an aspiring developer and would like some help with this issue, that is super annoying. Any Idea why I am getting this message? Thread 1: "[<UIViewController 0x7ff3bdc08a80> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key leadingHome." I have tried: Deleting home and re-adding it reconnecting all the points on the home controller Deleting the class and re-adding it Making a new class and changing Home over to it Setting the constraints and menu button itself to the class You can download my project at: https://www.icloud.com/iclouddrive/0vC-WfbeKKjLa6V05ofqhyayw#Riddle_Wednesday Thanks so much in advance!
4
0
619
Jan ’21
Setting UILabels to Firestore data
Hi, I would like to be able to take two fields of a firestorm document and then set two UILabels to those fields. Here is my code: import SafariServices import WebKit import Firebase class TheRiddle: UIViewController {          @IBOutlet weak var leading_TheRiddle: NSLayoutConstraint!     @IBOutlet weak var trailing_TheRiddle: NSLayoutConstraint!          @IBOutlet weak var CurrentRiddle: UILabel!     @IBOutlet weak var PreviousRiddle: UILabel!          var menuOut = false          override func viewDidLoad() {         super.viewDidLoad()                  let db = Firestore.firestore()                  db.collection("TheRiddle").document("Riddles").getDocument { (document, error) in                          //check for error             if error == nil {                 //check if document exists                 if document != nil {                 }else {                     if let currentRiddle = document!.get("CurrentRiddle") as? String {                         self.CurrentRiddle.text = "This Weeks Riddle: " + currentRiddle                     }                     if let previousRiddle = document!.get("CurrentRiddle") as? String {                         self.CurrentRiddle.text = "Previous Riddle: " + previousRiddle                     }                 }             }                      }                       }               @IBAction func RiddleAnswerForm(_ sender: Any) {         let vc = SFSafariViewController(url: URL(string: "https://forms.office.com/Pages/ResponsePage.aspx?id=ytAqTDte6UK-KD5v_kOm4Y843IzqmYtFlDtLrfRYsi1UMFpUMk1GN01GS05BVFlJUElONk4yR1hKUCQlQCN0PWcu")!)                  present(vc, animated: true)     }          @IBAction func menuTappedTheRiddle(_ sender: Any) {                  if menuOut == false {             leading_TheRiddle.constant = 150             trailing_TheRiddle.constant = -150             menuOut = true         }         else {             leading_TheRiddle.constant = 0             trailing_TheRiddle.constant = 0             menuOut = false         }         UIView.animate(withDuration: 0.2, delay: 0.0, options: .curveEaseIn, animations: {             self.view.layoutIfNeeded()         }) { (animationComplete) in             print("The animation is complete")         } } } Thanks in advance!
12
0
1k
Feb ’21
Why is this returning nil
Hi, this code is returning nil always. So frustrating! let today = Date() let calendar = Calendar(identifier: .gregorian) let components = calendar.dateComponents([.weekday], from: today) let nineThirtyToday = Calendar.current.date( bySettingHour: 90, minute: 30, second: 0, of: today) print(nineThirtyToday as Any) if components.weekday == 4 { if today = nineThirtyToday! { if UDM.shared.widgetDefaults?.value(forKey: "currentRiddle") as! String == currentRiddleFinal { currentRiddleFinal = "Waiting for update from server" } }else { print("Not Nine Thirty") } } UDM.shared.widgetDefaults?.setValue(currentRiddleFinal, forKey: "currentRiddle") print("Current Riddle: \(currentRiddleFinal)") } Thanks in advance!
9
0
1.6k
Mar ’21
Pushed over tabs
Hi, I am making an app and I am using tab navigation controller and the navigation controller, and whenever I push into another view controller through a segue, if I go to a different tab, then back to that one it's still on the pushed to view controller. Ideas on how to fix this. Thanks in advance!
11
0
943
Mar ’21
Multiple Table Views
Hi, I have a table view and am trying to implement a second, here is the code for the second one. The problem is the second one won't show any data. Please note that they're identical code: import UIKit import GoogleMobileAds class Home: UIViewController, GADBannerViewDelegate, UITableViewDelegate, UITableViewDataSource {     @IBOutlet weak var bannerView: GADBannerView!     @IBOutlet weak var ShowAds: UILabel!     @IBOutlet weak var bannerViewHeight: NSLayoutConstraint!     @IBOutlet weak var tableView: UITableView!     @IBOutlet weak var Welcome: UILabel!     var names = [         Utilities.mostRecent     ]       override func viewDidLoad() {         super.viewDidLoad()         // Do any additional setup after loading the view.         checkRecentCat()         Utilities.checkads(bannerView: bannerView, bannerViewHeight: bannerViewHeight)         if Utilities.openNum == 1 {             Welcome.text = "Welcome! Check out our app. In the categories section you will find all of our jokes!"         }       bannerView.rootViewController = self         bannerView.delegate = self         if Utilities.ShowAds == true {             ShowAds.text = "Show Ads: True"         }else if Utilities.ShowAds == false {             ShowAds.text = "Show Ads: False"         }       }     override func viewWillAppear(_ animated: Bool) {         super.viewWillAppear(animated)         checkRecentCat()         if UserDefaults.standard.bool(forKey: "JokesRUs.RemoveAds") {             Utilities.ShowAds = false             bannerViewHeight.constant = 0             ShowAds.text = "Show Ads: False"         }     }     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {         print("index path: \(indexPath.row)")         let row = indexPath.row         if row == 0 {             self.performSegue(withIdentifier: Utilities.mostRecentSegue!, sender: self)         }else if row == 1 {             self.performSegue(withIdentifier: Utilities.secondRecentSegue!, sender: self)         }else if row == 2 {             self.performSegue(withIdentifier: Utilities.thirdRecentSegue!, sender: self)         }         tableView.deselectRow(at: indexPath, animated: true)}     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) - Int {         return names.count     }         func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) - UITableViewCell {         let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)               cell.textLabel?.text = names[indexPath.row]                return cell     }     func checkRecentCat() {         print("Most Recent Cat: \(Utilities.mostRecent ?? nil)")         print("Second Most Recent Cat: \(Utilities.secondRecent ?? nil)")         if Utilities.secondRecent == nil || Utilities.secondRecentSegue == nil || Utilities.secondRecent == "Please choose a category to show" || Utilities.secondRecentSegue == "Please choose a category to show" {             Utilities.setSecondRecent(id: "Please choose a category to show", segue: "categories")         }         if Utilities.thirdRecent == nil || Utilities.thirdRecentSegue == nil || Utilities.thirdRecent == "Please choose a category to show" || Utilities.thirdRecentSegue == "Please choose a category to show" {             Utilities.setThirdRecent(id: "Please choose a category to show", segue: "categories")         }         if Utilities.mostRecent == nil || Utilities.mostRecentSegue == nil || Utilities.mostRecent == "Please choose a category to show" || Utilities.mostRecentSegue == "Please choose a category to show" {             Utilities.setMostRecent(id: "Please choose a category to show", segue: "categories")             tableView.isHidden = true         }else {             names = [Utilities.mostRecent]             if Utilities.secondRecent == nil || Utilities.secondRecentSegue == nil || Utilities.secondRecent == "Please choose a category to show" {             }else {                 names = [Utilities.mostRecent, Utilities.secondRecent]                 if Utilities.thirdRecent == nil || Utilities.thirdRecentSegue == nil || Utilities.thirdRecent == "Please choose a category to show" {                 }else {                     names = [Utilities.mostRecent, Utilities.secondRecent, Utilities.thirdRecent]                 }             }         }     }
2
0
433
Mar ’21
Set UIButton Image
Hi, Whenever I try to set a button's background image using the code below, the image goes blank instead of it changing. Ideas? @IBAction func showSaveCatDescript(_ sender: Any) { if showingSaveCatDescript == false { toggleShowSaveCatDescript.setImage(UIImage(named: "questionmark.circle.fill"), for: .normal) saveCatDescript.isHidden = false showingSaveCatDescript = true }else if showingSaveCatDescript == true { toggleShowSaveCatDescript.setImage(UIImage(named: "questionmark.circle"), for: .normal) saveCatDescript.isHidden = true showingSaveCatDescript = false } }
2
0
1.6k
Mar ’21
Run something before another thing
Hi, I have this code that I need to run in the exact line order, but I can't figure out how to do it. Things I have tried: DispatchQueue Aysnc completion handler functions Code: let pickedCat = Int.random(in: 1...4) //print("picked cat: \(pickedCat)") if pickedCat == 1 { getRandomJokes() randomJoke.text = "Random Joke: \(self.DadJokes)" //print("Random Joke: \(self.DadJokes)") }else if pickedCat == 2 { getAssistantJokes() randomJoke.text = "Random Joke: \(self.AssistantJokes)" //print("Random Joke: \(self.AssistantJokes)") }else if pickedCat == 3 { getKnockKnockJokes() randomJoke.text = "Random Joke: \(self.KnockKnockJokes)" //print("Random Joke: \(self.KnockKnockJokes)") }else if pickedCat == 4 { getRandomJokes() randomJoke.text = "Random Joke: \(self.RandomJokes)" //print("Random Joke: \(self.RandomJokes)") } if randomJoke.text == "Random Joke: " { randomJoke.text = "Random Joke: Failed to connect to server" }
39
0
2.6k
Apr ’21
Why is this crashing?
Whenever I run this code, after I have purchased something and it shifts up after leaving and reopening the page it crashes with the error "Index out of range". Code - https://developer.apple.com/forums/content/attachment/86665b01-4c50-47bd-a14d-ef95b58db511 Ideas? Thanks in advance! Ps: I can provide full project if needed.
17
0
1.8k
May ’21
Why is this clearing?
This is driving me crazy. I have this code: Utilities.getKnockKnockJokes {             self.previousKnockKnockJoke = self.currentKnockKnockJoke             print("currentKnockKnockJoke = \(self.currentKnockKnockJoke)")             self.currentKnockKnockJoke = KnockKnockJokes.knockKnockJokes.randomElement()!             print("newCurrentKnockKnockJoke = \(self.currentKnockKnockJoke)")             self.singleServeText.text = self.currentKnockKnockJoke         } The function that is called is bellow: getKnockKnockJokes Thank you in advanced!
3
0
549
Jul ’21