Is it possible to test iOS4 multitasking/background music playing on the simulator?

I too had the same issue. In simulator the audio pauses and when you launch it back it resumes playback. But testing on device it worked perfectly and audio continued to play in background. The sample code which i have used is AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil]; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; [audioPlayer play];

Detect if app is running in Slide Over or Split View mode in iOS 9

Just check if your window occupies the whole screen: BOOL isRunningInFullScreen = CGRectEqualToRect([UIApplication sharedApplication].delegate.window.frame, [UIApplication sharedApplication].delegate.window.screen.bounds); If this is false, then you’re running in a split view or a slide over. Here is the code snipped which will automatically maintain this flag irrespective of rotation -(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { // simply create a property of ‘BOOL’ … Read more

Max number of goroutines

If a goroutine is blocked, there is no cost involved other than: memory usage slower garbage-collection The costs (in terms of memory and average time to actually start executing a goroutine) are: Go 1.6.2 (April 2016) 32-bit x86 CPU (A10-7850K 4GHz) | Number of goroutines: 100000 | Per goroutine: | Memory: 4536.84 bytes | Time: … Read more

When an iOS application goes to the background, are lengthy tasks paused?

From the documentation: Return from applicationDidEnterBackground(_:) as quickly as possible. Your implementation of this method has approximately five seconds to perform any tasks and return. If the method doesn’t return before time runs out, your app is terminated and purged from memory. If you need additional time to perform any final tasks, request additional execution … Read more

Is it possible to opt your iPad app out of multitasking on iOS 9

To opt-out (disable) multi-tasking for your application: Select your Target → General Section → Scroll Down and check Requires full screen It gets applied to the plist’s UIRequiresFullScreen key value. Note: Apps are required to support all screen orientations if it supports multitasking. Otherwise, apps will get the following error on publishing: Invalid Bundle. iPad … Read more

Sprite Kit & playing sound leads to app termination

The problem is AVAudioSession can’t be active while the app enters background. This isn’t immediately obvious because Sprite Kit makes no mention that it uses AVAudioSession internally. The fix is quite simple, and also applies to ObjectAL => set the AVAudioSession to inactive while the app is in background, and reactivate the audio session when … Read more

Best way to read from a sensor that doesn’t have interrupt pin and requires some time before the measurement is ready

How to do high-resolution, timestamp-based, non-blocking, single-threaded cooperative multi-tasking This isn’t a “how to read a sensor” problem, this is a “how to do non-blocking cooperative multi-tasking” problem. Assuming you are running bare-metal (no operating system, such as FreeRTOS), you have two good options. First, the datasheet shows you need to wait up to 9.04 … Read more