uiapplication

openURL from App Extension

独自空忆成欢 提交于 2019-11-27 22:11:35
On iOS 8 beta 2 it should be possible to use openUrl from app extension as written into the release notes: however when I try to use this API (on Xcode 6 beta 2) I get the following error: Beta 2 really fixed this issue or not? Laurence Fan you may use this code: [self.extensionContext openURL:url completionHandler:^(BOOL success) { NSLog(@"fun=%s after completion. success=%d", __func__, success); }]; the API document: openURL:completionHandler: you could also refer to this question: openURL not work in Action Extension Accepted solution only works in Today extensions , a working solution in

canOpenURL failing for system-wide URL schemes

谁说胖子不能爱 提交于 2019-11-27 22:01:40
问题 I'm running iOS 9b5. In my app, if a device can make a phone call, I want to color the text blue so it looks tappable. If not, I leave it black. In order to determine the device capabilities, I use: [[UIApplcation sharedApplication] canOpenURL:@"telprompt://5555555555"] As we all know, iOS 9 requires we whitelist any URL schemes we'll be using in our app as a privacy measure. I have this in my Info.plist: <key>LSApplicationQueriesSchemes</key> <array> <string>telprompt</string> </array> No

Need clarification about UIApplicationState

孤者浪人 提交于 2019-11-27 21:18:55
问题 I need your help in clarifying my understanding of the various states of an app. I am going to state my interpretation - but please feel free to correct me. 1) App is launched and running in the foreground: state = UIApplicationStateActive 2) User pushes home button: state = UIApplicationStateBackground (????). Debug stmt in my app shows it to be Active 3) User double-taps Home and kills the app: state = UIApplicationStateInactive If the value for case 2 is indeed Active, then when is the

Can an iOS App Switch to Safari Without Opening a Page?

我的梦境 提交于 2019-11-27 19:33:49
I know that my app can open a particular URL in Safari by doing something like this: [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.example.com/"]]; but, is there any way to have my app switch over to Safari without opening a URL? I'd like to switch to Safari, but let it keep showing whatever page it had open the last time the user looked at it. Unfortunately no, unless you can figure out how to launch an app by bundle id in a non-jailbroken environment. Otherwise, if you are in a jailbroken environment, you can use the following to launch an app by its bundle id:

Check if my IOS application is updated

旧街凉风 提交于 2019-11-27 15:47:56
问题 I need to check when my app launches if it was being updated, because i need to make a view that only appears when the app is firstly installed to appear again after being updated. 回答1: You could save a value (e.g. the current app version number) to NSUserDefaults and check it every time the user starts the app. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // ... NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

How to get the current application icon in ios

烂漫一生 提交于 2019-11-27 13:41:43
问题 Is there a way to get the current application icon in a cocoa-touch app? Thank you. 回答1: Works for Swift 4.1 and extending it for Bundle. extension Bundle { public var icon: UIImage? { if let icons = infoDictionary?["CFBundleIcons"] as? [String: Any], let primaryIcon = icons["CFBundlePrimaryIcon"] as? [String: Any], let iconFiles = primaryIcon["CFBundleIconFiles"] as? [String], let lastIcon = iconFiles.last { return UIImage(named: lastIcon) } return nil } } To use in an app, call Bundle.main

iOS How can I use UIApplication launchApplicationWithIdentifier which is in private APIs?

大兔子大兔子 提交于 2019-11-27 06:18:28
问题 [EDIT]I've jb my device. And I found the latest private APIs iOS-Runtime-Headers on Github. I want to use private APIs in my app. I found kennytm/iphone-private-frameworks on github but it only support iOS 3.x. While I'm working on iOS 5.0.1. I also found some codes on Google iPhone development tools. But it really make me confused. I'm new to iPhone development. What should I do to use [[UIApplication sharedApplication] launchApplicationWithIdentifier:@"com.a.b" suspended:NO]; Someone can

Differentiate between screen lock and home button press on iOS7

﹥>﹥吖頭↗ 提交于 2019-11-27 04:34:10
问题 I need to do something in applicationDidEnterBackground . But I need to differentiate which user action causes the "enter background": screen lock or home button press. I was using this code, which is from this post - How to differentiate between screen lock and home button press on iOS5?: UIApplicationState state = [application applicationState]; if (state == UIApplicationStateInactive) { NSLog(@"Sent to background by locking screen"); } else if (state == UIApplicationStateBackground) {

What describes the Application Delegate best? How does it fit into the whole concept?

江枫思渺然 提交于 2019-11-27 03:40:24
I think to know what the App Delegate does. It has some nice methods like -applicationDidFinishLaunching which will be called when the app has finished launching, and so on. But what's that actually? Is that some object instantiated in the UIApplicationMain function? And how does it work that every class in my app has access to that App Delegate object? Is there any good graph on the net that visualizes these relationships? In Cocoa, a delegate is an object that another object defers to on questions of behavior and informs about changes in its state. For instance, a UITableViewDelegate is

How do I prevent the iPhone screen from dimming or turning off while my application is running?

流过昼夜 提交于 2019-11-27 02:37:27
I'm working on an app that requires no user input, but I don't want the iPhone to enter the power saving mode. Is it possible to disable power saving from an app? lajos Objective-C [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; Swift UIApplication.shared.isIdleTimerDisabled = true Aby Mathew In swift you can use this as UIApplication.sharedApplication().idleTimerDisabled = true Swift 3: UIApplication.shared.isIdleTimerDisabled = true JMStudios.jrichardson I have put this line of code in my view controller yet we still get customers saying the screen will dim or turn off until