Post

Replies

Boosts

Views

Activity

Managing local notifications
I created this code that sends local notification after user reaches the view controller, but the notification is sent each time the user goes to the view controller. How do I make it send the notification only once? What change should I make in my code? import UserNotifications class firstViewController: UIViewController, UNUserNotificationCenterDelegate { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. let center = UNUserNotificationCenter.current() center.delegate = self center.requestAuthorization(options: [.badge,.sound,.alert]) { granted, error in if error == nil { print("User permission is granted : \(granted)") } } // Step-2 Create the notification content let content = UNMutableNotificationContent() content.title = "Hello" content.body = "Welcome" // Step-3 Create the notification trigger let date = Date().addingTimeInterval(2) let dateComponent = Calendar.current.dateComponents([.year,.month,.day,.hour,.minute,.second], from: date) let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponent, repeats: false) // Step-4 Create a request let uuid = UUID().uuidString let request = UNNotificationRequest(identifier: uuid, content: content, trigger: trigger) // Step-5 Register with Notification Center center.add(request) { error in } } func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { completionHandler([.sound,.banner,.badge]) } }
1
0
631
Mar ’22
Change view controller automatically doesn't work
In my app I've got moment where I use timer to go from one view controller to next view controller, and it doesn't work. Could somebody tell me what's wrong? class fifthViewController: UIViewController {     override func viewDidLoad() {         super.viewDidLoad()                  let delay : Double = 2.0    // 2 seconds here         DispatchQueue.main.asyncAfter(deadline: .now() + delay) {             let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)             let IDKViewController = storyBoard.instantiateViewController(withIdentifier: "IDKview") as! IDKViewController             self.present(IDKViewController, animated:true, completion:nil)         }     }          }
4
0
805
Dec ’21
How can I create a share button for my app
In my app I want to create share button so that user can quickly share the app. How do I do that?
Replies
0
Boosts
0
Views
388
Activity
Aug ’22
Export compliance information managing
My app has buttons that send you to it's Instagram, Facebook and Twitter accounts so does it use encryption?
Replies
0
Boosts
0
Views
361
Activity
Jul ’22
deleted viewcontroller still appears in simulator
In my app I had created a initial vc, but I didn't really liked the design I've done so I changed it to a new one. Now the simulator is showing me the old design for a little while, and then it goes to the proper new one. How do I make the old one disappear? (I deleted the file of the old one )
Replies
0
Boosts
0
Views
389
Activity
Jun ’22
Managing local notifications
I created this code that sends local notification after user reaches the view controller, but the notification is sent each time the user goes to the view controller. How do I make it send the notification only once? What change should I make in my code? import UserNotifications class firstViewController: UIViewController, UNUserNotificationCenterDelegate { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. let center = UNUserNotificationCenter.current() center.delegate = self center.requestAuthorization(options: [.badge,.sound,.alert]) { granted, error in if error == nil { print("User permission is granted : \(granted)") } } // Step-2 Create the notification content let content = UNMutableNotificationContent() content.title = "Hello" content.body = "Welcome" // Step-3 Create the notification trigger let date = Date().addingTimeInterval(2) let dateComponent = Calendar.current.dateComponents([.year,.month,.day,.hour,.minute,.second], from: date) let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponent, repeats: false) // Step-4 Create a request let uuid = UUID().uuidString let request = UNNotificationRequest(identifier: uuid, content: content, trigger: trigger) // Step-5 Register with Notification Center center.add(request) { error in } } func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { completionHandler([.sound,.banner,.badge]) } }
Replies
1
Boosts
0
Views
631
Activity
Mar ’22
Does App Store connect update automatically with Xcode
I wanted to submit my app to App Store so I signed up to Apple developer program and started filling up data in App Store connect. In the meantime I changed a few things in my app in Xcode and I'm curious if these changes had also been made in App Store connect.
Replies
0
Boosts
0
Views
459
Activity
Jan ’22
Change view controller automatically doesn't work
In my app I've got moment where I use timer to go from one view controller to next view controller, and it doesn't work. Could somebody tell me what's wrong? class fifthViewController: UIViewController {     override func viewDidLoad() {         super.viewDidLoad()                  let delay : Double = 2.0    // 2 seconds here         DispatchQueue.main.asyncAfter(deadline: .now() + delay) {             let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)             let IDKViewController = storyBoard.instantiateViewController(withIdentifier: "IDKview") as! IDKViewController             self.present(IDKViewController, animated:true, completion:nil)         }     }          }
Replies
4
Boosts
0
Views
805
Activity
Dec ’21
How to set timer to go to next view controller
I would like my app to change view controllers after certain period of time. How to do this?
Replies
2
Boosts
0
Views
1.9k
Activity
Dec ’21
How to set timer to show text after certain period of time on screen
In my app I have a black screen at one point and I want the user to know that it's not the end. I want to display text "tap to go next" on the bottom of the screen. To do that I'll need to use timer to show the text after couple of seconds. I don't know how to do it. Could anyone help?
Replies
1
Boosts
0
Views
1.4k
Activity
Dec ’21