Hey,
is there a way to enable the email notifications for this forum again?
Because I didn't get them since a while...
Thanks!
Post
Replies
Boosts
Views
Activity
Hey there,
I created a video player like this one: https://developer.apple.com/documentation/avfoundation/media_playback_and_selection/creating_a_basic_video_player_ios_and_tvos
But if the video file can not load (because of wrong url or missing internet connection) the player is just showing this loading-circle.
So there is no information whether the video file can be loaded or not.
Is there a way to check if a video file from the internet is available or not?
Thanks!
Hey there,
recently I changed the background color of my simulator by mistake.
I typed in a ViewController:
ProgressBar.backgroundColor = UIColor.yellow
After that the background color of my simulator was yellow 😂. This means all the menus, Control Centre etc.
This is a funny issue but now I want to change it to the default.
Changing it the same way like above does not work unfortunately.
Can someone help me?
Hey there,
it is possible to add an action to an UIImageView?
Or do I have to place a button around it?
Hey there,
I have the following problem:
When I change the value of an array in a for-loop the array is not saved with this new value.
Example:
var numbers = [2, 3, 4, 6, 9]
let theNumber = 4
print("Numbers old: \(numbers)")
for var number in numbers {
if number == theNumber {
print("Numbers are identical")
number = 10
/*save the changed number in array*/
}
}
print("Numbers new: \(numbers)")
The console output is:
Numbers old: [2, 3, 4, 6, 9]
Numbers are identical
Numbers new: [2, 3, 4, 6, 9] So the value of the array is not changed.
How to modify the code so that the value of the array is changed?
Is there an easy way to do so?
Help is very welcome!
Thank you!
Hey there,
I wanted to play a local video in my app using the Apple introduction (https://developer.apple.com/documentation/avfoundation/media_assets_playback_and_editing/creating_a_basic_video_player_ios_and_tvos ).
Unfortunately it is not possible to use a local file for this.
Here is my code:
@IBAction func playVideo(_ sender: Any) {
guard let path = Bundle.main.url(forResource: "Video", withExtension: "mp4") else {
print("Video file not found")
return
}
let player = AVPlayer(url: path)
let controller = AVPlayerViewController()
controller.player = player
present(controller, animated: true) {
player.play()
}
}
Where is the issue?
In console I always get the message "Video file not found".
I implemented the video file in Assets.xcassets.
Help is welcome!
Hey there,is there an easy way to create a diagram for a statistic in an app or do I have to use 20000000 views to depict the individual pillars?Thanks!
Hey there,since there are keyboards for the ipad it makes sense to use shortcuts in your application e.g. for a specific button.In a macOS App I can simply set one in the interface builder but with an iPad iOS app it seems not to be possible that way...Do you know how to add a shortcut to a button (e.g. the button's action should be executed if you press the "return" key on your iPad external keyboard) ?Help would be very welcome!Thanks a lot!
Hey there,how do I add a option to a local notification that you can click on it (or a button) an it will go to a view of the app which is not the initial view controller?here my code so far:let center = UNUserNotificationCenter.current()
var content = UNMutableNotificationContent()
content.title = "Title)"
content.body = "Body"
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 300, repeats: false)
let uuidString = UUID().uuidString
let request = UNNotificationRequest(identifier: uuidString, content: content, trigger: trigger)
center.add(request) { (error) in
[...]
}Thanks for helping!
Hey there,I want a macOS app to use a login item. I found this here, but it's a quite old document, difficult to understand, and not executable because of some errors.So do you know a suitable way to implement a login item? Preferably it should be installed itself when the user install the application.Thanks a lot!
Hey there,I wanted to use this to create a background task for my MacOS App.Unfortunately I don't knwo how to insert the code.I createdlet activity = NSBackgroundActivityScheduler(identifier: "com.example.MyApp.work")in AppDelegate and insertactivity.repeats = true
activity.interval = 30in applicationDidFinishLaunching() to initialize the values.But where is the right place to insertactivity.schedule() { (completion: NSBackgroundActivityScheduler.CompletionHandler) in
// Perform the activity
print("Hello World")
self.completion(NSBackgroundActivityScheduler.Result.Finished)
}in that way that this application will get a background task, which is not stopped if I quit (or leave) the application?Maybe that's an sutpid question but if so it sould be easy to answer ;-)Thanks a lot!
Hey there,I have an App which should do something in background.So I wrote some code in AppDelegate:func applicationDidEnterBackground(_ application: UIApplication) {
print("BackgroundActivity in Delagate")
Timer.scheduledTimer(withTimeInterval: 30, repeats: true) { timer in
//Do something
} else {
//Do something different
}
}
}Now, every time if the application enter background I get this error in console: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 to fix it with usingDispatchQueue.global(qos: .background).async {
self.BackgroundActivity()
DispatchQueue.main.async {
print("Hello")
}
}in viewDidLoad() of the initial view controller to start the background task already if the application is in foreground. The tast does not work and when I go to background I get the same error.Anyone an idea what to do?Thanks a lot!
Hey there,how it is (easily!) possible to round a double to 3 decimal numbers in Swift 5?Example:let double = 34.53320218print(double rounded)Thank you!