Post

Replies

Boosts

Views

Activity

Reply to Timer im background Task not possible?
Sry for the late reply.Yes it's actually a local notification. There is no web service needed.The only thing the application wants to do in background, is to wait for 30 minutes and then send a notification. If you tap on the notification the user should be navigated into the app and all other steps are inclued there.
Jan ’20
Reply to Timer im background Task not possible?
Thank you. So do I need both notification triggers or is one enough? If there is a choice I would prefer the interval notification trigger. (Listening also shows what I want). Do I need to create a new class for this or can I use a specific function? Remember the trigger should starts if application enters background... Thanks again!
Jan ’20
Reply to Timer im background Task not possible?
My current code is the following://Asking for permissions let center = UNUserNotificationCenter.current() print("Authorizsation:") center.requestAuthorization(options: [.alert, .sound]) { granted, error in print("Error") } //create the notification let content = UNMutableNotificationContent() content.title = "Hello" content.body = "30 Sec are over" let trigger = UNTimeIntervalNotificationTrigger(timeInterval: (30), repeats: true) // Create the request let uuidString = UUID().uuidString let request = UNNotificationRequest(identifier: uuidString, content: content, trigger: trigger) // Schedule the request with the system. //let notificationCenter = UNUserNotificationCenter.current() center.add(request) { (error) in if error != nil { print("Error2: \(error)") } }Bad thing is that nothing happens...In console I can see:Authorizsation:ErrorFor testing I implement it in an action of a button. In future it should starts automatically with viewDidLoad() or applicationDidEnterBackground() or (much better) a system function after the iPhone is booting.Do you have any further ideas?
Feb ’20
Reply to Timer im background Task not possible?
Error is "nil". (Even though I allowed notifications first time)Additionally I get this error in the console as soon as my app is running:invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.If I quit the app with swipe from bottom to top (iPhone 11 Simulator) I get the error code like I get with the timer. So it seems like the trigger is not working correctly:Can't end BackgroundTask: no background task exists with identifier 1 (0x1), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.I tried the same code in a macOS App and there it works... very strange...
Feb ’20
Reply to Timer im background Task not possible?
Thank you for the advice!Now I find the issue: the notification is not coming if the app is open (in foreground) when it should come.So if I cklick on home button after activate the notification it works. But unfortunately having the app in foreground stops the notification for ever. So it is not delivered it I quit the app...
Mar ’20
Reply to Shortcut iPad for a button?
Thanks, but how do I use it?if I use:self.textFieldShouldReturn(self.Input)in a timer it always "jumps accross" the return key. So without that I tapped on "return". It is executed as soon as I call it.But if I call it I don't want to execute it - I want it to check if the user is tapping on "return".Or do I must use it otherwise?
Jun ’20
Reply to Verschwundener Button in Xcode
Also du brauchst dafür den Assistant Editor.Um das irgendwie sinnvoll zu gestalten solltest du erstmal dem entsprechenden Storyboard die Klasse zuweisen, die du dafür benutzt.Dafür wählst du das Storyboard aus und blendest den Identity Inspector ein (diese Registerkarte oben rechts) und wählst bei "Class" die Swift Datei aus, in der du den Code schreiben willst. Die sollte vom gleichen Typ sein wie das Storyboard (Also normalerweise "ViewController"). Beachte, dass dies nicht bei dem Launch Screen funktionieren wird.Anschließend blendest du den Assistant Editor ein (control + option + command + enter), klickst auf den Button und ziehst dann mit gedrücker control-Taste eine Verbindung von dem Button in die Datei. In erscheinenden Fenster kannst du dann als Art "Action" auswählen. Damit bekommst du eine Aktion die ausgeführt wird, sobald du den Button drückst.Ich hoffe, das hilft dir so weiter!
Jun ’20
Reply to Local video won't play
Thanks for the answers! It was just not possible to drag the video file in the bundle... so I placed it in the Asset Catalog. What exactly do you mean with "bundle"? Is it the first level of my file "ProjectName" where are files such "ProjectName.xcodeproj" or the second level "/ProjectName/ProjectName" where are my Swift files? Or something completely different?
Jun ’20