Post

Replies

Boosts

Views

Activity

Reply to How i can call func from another ViewController?
This Code: I mean version ios 14 and up var didDetectOutgoingCall = false func showCallAlert() { guard let url = URL(string: "tel:+36201234567"), UIApplication.shared.canOpenURL(url) else { return } callObserver.setDelegate(self, queue: nil) didDetectOutgoingCall = false UIApplication.shared.open(url, options: [:]) { [weak self] success in if success { DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { self?.addNotifObserver() } } } } func addNotifObserver() { let selector = #selector(appDidBecomeActive) let notifName = UIApplication.didBecomeActiveNotification NotificationCenter.default.addObserver(self, selector: selector, name: notifName, object: nil) } @objc func appDidBecomeActive() { //if callObserver(_:callChanged:) doesn't get called after a certain time, //the call dialog was not shown - so the Cancel button was pressed DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in if !(self?.didDetectOutgoingCall ?? true) { print("Cancel button pressed") } } } func callObserver(_ callObserver: CXCallObserver, callChanged call: CXCall) { if call.isOutgoing && !didDetectOutgoingCall { didDetectOutgoingCall = true print("Call button pressed") } } if i can the func showCallAlert() from anther viewcontroller it not detected if print("Cancel button pressed") or print("Call button pressed"), why?
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’22
Reply to Is a Read-Only GET Request Without User Data Considered ‘No Data Collection’?
I do not perform any POST requests and do not collect or send any user data. The app only performs GET requests to fetch a JSON file that I uploaded to a hosting site for app functionality. Is it correct to select "No, we do not collect data from this app"? I want to be completely sure before submitting.
Replies
Boosts
Views
Activity
Jun ’25
Reply to How i can call func from another ViewController?
This Code: I mean version ios 14 and up var didDetectOutgoingCall = false func showCallAlert() { guard let url = URL(string: "tel:+36201234567"), UIApplication.shared.canOpenURL(url) else { return } callObserver.setDelegate(self, queue: nil) didDetectOutgoingCall = false UIApplication.shared.open(url, options: [:]) { [weak self] success in if success { DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { self?.addNotifObserver() } } } } func addNotifObserver() { let selector = #selector(appDidBecomeActive) let notifName = UIApplication.didBecomeActiveNotification NotificationCenter.default.addObserver(self, selector: selector, name: notifName, object: nil) } @objc func appDidBecomeActive() { //if callObserver(_:callChanged:) doesn't get called after a certain time, //the call dialog was not shown - so the Cancel button was pressed DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in if !(self?.didDetectOutgoingCall ?? true) { print("Cancel button pressed") } } } func callObserver(_ callObserver: CXCallObserver, callChanged call: CXCall) { if call.isOutgoing && !didDetectOutgoingCall { didDetectOutgoingCall = true print("Call button pressed") } } if i can the func showCallAlert() from anther viewcontroller it not detected if print("Cancel button pressed") or print("Call button pressed"), why?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to function not transfer to vc
it for IOS I tried it and it also does not work, It prints me at the console: whose view is not in the hierarchy window. To the third question: Yes I am sure and I too made sure it was HomeVC (And I also took care of capital letters)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’22