Categories
Mastering Development

Swift Button crashes after #selector is used

I have managed to get the text field validation working which doesn’t allow the add button to be active unless there is text in the textbox field. However, now when I press the add button the app crashes. I have done some research and it looks like its because of the: calarieSubmit.addTarget(self, action: #selector(calarieSubmitDidChange), for: […]

Categories
CMS Development Wordpress

Why do my custom post types stop displaying over time?

I have a skill development project I am working on here: https://blog.unicornpoint.net/wp/safe-foods-meal-generator-diet-assistant/ . This is a custom template page. I am using Custom Posts UI for custom post type meals and ACF for some custom fields. Over time, some of the meals stop displaying on the page. I have meals listed at the bottom depending […]

Categories
Development

How to pick, display two images on two UIImageViews, and then upload these two chosen images to Firebase Database and Storage?

I want to pick two different images on two imageView’s on one ViewController, display them, and after pushing the button save picked images to firebase database and storage to its particular user. My code only able to upload one picked image, not two different, I understand that the problem with UIImagePickerController part, but how can […]

Categories
Development

AVPlayer videos not loading all the time

My app uses AVPlayer to play my videos however they do not play every time. I just get a black screen on some videos. However the videos that don’t play aren’t the same every time. I don’t understand why one minute it works and then the next it doesn’t. I am using the HCVimeoVideoExtractor in […]

Categories
Development

Chat Application using firebase

1.First of all install following pods: pod ‘Firebase/Core’ pod ‘Firebase/Storage’ pod ‘Firebase/Auth’ pod ‘Firebase/Database’ pod ‘JSQMessagesViewController’ 2.Then Create account on firebase account and get googleService-info.plist file and add it into project directory Implement Below class import UIKit import FirebaseAuth import FirebaseDatabase import JSQMessagesViewController struct Constants { struct refs { static let databaseRoot = Database.database().reference() static […]

Categories
Development

Game of Fifteen (Swift): extra touch to confirm all the buttons are arranged

Could anyone tell me what is wrong with the logic? I make a game of Fifteen and faced a problem. I need to be sure all the fifteen buttons are arranged in a proper way: logic: Every time a button is touched 1. function makeMove() changes the position of a button . 2. function checkGameOver() […]

Categories
Development

Why is a UIAlertAction’s handler required to have a parameter that references the UIAlertAction?

I’m working with a simple button that, when pressed, runs a function I created. Originally, I wrote the code like this: func askQuestion() { // runs code to ask a question } @IBAction func buttonTapped(_ sender: UIButton) { let ac = UIAlertController(title: title, message: “You tapped the button.”, preferredStyle: .alert) ac.addAction(UIAlertAction(title: “Continue”, style: .default, handler: […]

Categories
Development

Xcode: Why is my optional value nill while unwrapping?

Can someone please look trough my code and tell me why my value is nil. If you need me to post other files I will. The project is mostly firebase and the app crashes whenever you try to post within the application. I believe it is crashing when the screen has to be updated because […]

Categories
Development

Xcode: Why is my optional value nill while unwrapping?

Can someone please look trough my code and tell me why my value is nil. If you need me to post other files I will. The project is mostly firebase and the app crashes whenever you try to post within the application. I believe it is crashing when the screen has to be updated because […]

Categories
Development

present() method in alert view shows error

I can’t use the method present(). The error is: Value of type ‘ProductByBrandCollectiionView’ has no member ‘present’ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let alert = UIAlertController(title: “Alert”, message: “You select\(NameArray[indexPath.row])”, preferredStyle: .alert) let action = UIAlertAction(title: “Ok”, style: .default, handler: nil) alert.addAction(action) print(“You select \(NameArray[indexPath.row])”) self.present(alert, animated: true, completion: nil) }