multitasking

Only applicationWillResignActive called when iPhone shuts down?

狂风中的少年 提交于 2019-12-21 04:17:16
问题 Hallo experts, I've tested what's happing with my app when the iPhone is switched off while the app is active. For this purpose I logged the callback methods of the app's lifecycle in the xcode debugger console. The result was: When I press the on/off button of the device for some time applicationWillResignActive is called. The iPhone shows an option to switch off the device on the screen. If I ackknowlege to switch off, the iPhone shuts down. But apperently no further callback methods like

How to do multithreading, concurrency or parallelism in iOS Swift?

空扰寡人 提交于 2019-12-20 08:21:09
问题 Is there any way to create a worker thread in Swift?, for example, if there's a major functionality that requires a lot of calculations and hence causes the main thread to delay for a few seconds, if I would like to move that functionality to a separate thread or a thread that do not block the main thread is there any way to do it with Swift? I've gone through the basic and advanced components of the Apple Documentation for Swift but there's nothing about concurrency or parallelism, do anyone

What method is called after 'applicationDidBecomeActive'?

六月ゝ 毕业季﹏ 提交于 2019-12-19 09:33:13
问题 it's my first question here as I have a problem developing my first iOS app. It is one of the thousands of flashlight apps, however I'm trying to put as many features as possible to it. One of them is saving the state of the app when it goes to background or terminates. After going to foreground (iOS 4 or higher) or relaunching, I'm loading the settings from file and reapplying them. One of the settings is, obviously, the AVCaptureDevice.torchMode . However, I encounter the problem with this.

MPMoviePlayerController multitasking problem

不想你离开。 提交于 2019-12-19 03:50:06
问题 I develop an application on iphone that uses MPMoviePlayerController to play audio file. When Application goes to background, if mpmovieplayer is playing, iphone continues to play the current music, but when it ends, the next track doesn't start. I try to start the next audio file in the MPMoviePlayerPlaybackDidFinishNotification and when I follow the code using the debugger I can see that the method is invoked and the code executed, bat the next audio file still doesn't start. Is this

Using lock screen for my app?

假装没事ソ 提交于 2019-12-18 12:44:28
问题 I'd like to make my app use the audio buttons on the lock screen while multitasking. (Yes, like Pandora.) What API am I looking to use? 回答1: See the Remote Control of Multimedia docs. Basically, you just need to call -beginReceivingRemoteControlEvents on your shared application instance, then register something (probably your main view controller) as the first responder and implement the -remoteControlReceivedWithEvent: method on it. You will get events both from the lock-screen controls and

How to create a thread/Task with a continuous loop?

Deadly 提交于 2019-12-18 10:07:12
问题 I am looking for the correct way/structure to create a loop in a Thread/Task ... The reason for this is, i need to check the DB every 15sec for report requests. This is what i tried so far, but i get OutOfMemoryException : private void ViewBase_Loaded(object sender, RoutedEventArgs e) { //On my main view loaded start thread to check report requests. Task.Factory.StartNew(() => CreateAndStartReportRequestTask()); } private void CreateAndStartReportRequestTask() { bool noRequest = false; do { /

Quit app when pressing home

我只是一个虾纸丫 提交于 2019-12-18 06:49:50
问题 I my testing, when I exit (by pressing the home button) my app, it still is "running" in the background, thanks to the multitasking feature. However, I would like it to quit when the home button is pressed. Is this only happening to me? Anyway, I have tracked it down to the applicationWillResignActive and the applicationDidBecomeActive methods in the app delegate. These get called for multitasking, but when I want to terminate, the app "resigns active." Any guidance on this issue is greatly

applicationWillEnterForeground: reload Data from ViewController

时光总嘲笑我的痴心妄想 提交于 2019-12-18 04:24:07
问题 I want my app to reload data as soon as the app switches from the background to the foreground. Thats my code: DataAppDelegate.h #import <UIKit/UIKit.h> #import "DataViewController.h" @class DataViewController; @interface DataAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; DataViewController *viewController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet DataViewController *viewController; @end AppDelegate.m #import

Detecting user settings for Background App Refresh in iOS 7

有些话、适合烂在心里 提交于 2019-12-17 22:29:25
问题 Starting with iOS 7, Apple's Multitasking APIs allow apps to run in three new Background Modes: Background fetch, Remote notification content, and Background transfer service. Apple also gives iOS users the ability to control whether all apps are allowed to run in the background or whether individual apps can run in the background (Settings > General > Background App Refresh). Is there is a way for my app to programmatically detect whether the user has disabled my app's ability to refresh in

Detecting when app is becoming active from lockscreen vs other on iOS7

半世苍凉 提交于 2019-12-17 19:15:56
问题 My app has different behavior when becoming active from the lockscreen (locked while active), or becoming active from anything else. On iOS 6 and lower I could detect this UIApplicationState state = [[UIApplication sharedApplication] applicationState]; if (UIApplicationStateInactive == state) // Coming from locked screen (iOS 6) else // Coming from Springboard, another app, etc... But on iOS 7, the state value is UIApplicationStateBackground in both scenarios. Is this the intended behavior?