uiapplication

Open Settings warning issue in Xcode 6.3: Comparison of address of 'UIApplicationOpenSettingsURLString' not equal to a null pointer is always true

[亡魂溺海] 提交于 2019-12-01 04:35:39
I'm not inventing the wheel. In iOS8, to open Settings from inside the app I'm using this code: BOOL canOpenSettings = (&UIApplicationOpenSettingsURLString != NULL); if (canOpenSettings) { NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; [[UIApplication sharedApplication] openURL:url]; } The code is in a lot of answers and questions in stackoverflow. The problem came out with Xcode 6.3, I've got a warning saying: Comparison of address of 'UIApplicationOpenSettingsURLString' not equal to a null pointer is always true What is interesting is that Apple is using it in their

Open Settings warning issue in Xcode 6.3: Comparison of address of 'UIApplicationOpenSettingsURLString' not equal to a null pointer is always true

三世轮回 提交于 2019-12-01 01:38:51
问题 I'm not inventing the wheel. In iOS8, to open Settings from inside the app I'm using this code: BOOL canOpenSettings = (&UIApplicationOpenSettingsURLString != NULL); if (canOpenSettings) { NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; [[UIApplication sharedApplication] openURL:url]; } The code is in a lot of answers and questions in stackoverflow. The problem came out with Xcode 6.3, I've got a warning saying: Comparison of address of

UIApplicationDidEnterBackgroundNotification

﹥>﹥吖頭↗ 提交于 2019-11-30 13:52:02
whats the use of UIApplicationDidEnterBackgroundNotification in iPhone app or how we can take benifit from it This notification means the user "quit" your app on an iPhone 4 - It happens when a phone call or text message comes in and user accepts the interruption (answers/replies), or when the user has pressed the Home button. I found this link on SO that shows the interaction between all states, and the appropriate notifications: http://www.drobnik.com/touch/2010/07/understanding-ios-4-backgrounding-and-delegate-messaging/ To make use of this notification you can implement

Getting a reference to the UIApplication delegate

蹲街弑〆低调 提交于 2019-11-30 12:40:09
问题 I'm writing my first iPhone application and I'm having trouble switching views. I have 2 views and a reference to each in the AppDelegate (an instance of UIApplicationDelegate ). I create instances of both in the applicationDidFinishLaunching and immediately show the first view. This works fine. The problem is the reference to the other view is in the AppDelegate and I can't figure out how to get a reference to it so I can switch to the other view. Is there a way to get a reference to the

How to get the name of the running application in iOS

好久不见. 提交于 2019-11-30 12:22:09
问题 If the application name under the icon on the home screen is "My Awesome App" how do you get that string within the application at runtime? 回答1: I’d try [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; although presumably you know your own app’s name and can just use it… 回答2: Swift 3 & 4 Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String ?? "" Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String ?? "" Swift 2.2 NSBundle

Open Gmail app from my app

陌路散爱 提交于 2019-11-30 11:03:58
问题 I'm trying to send an email from my app. But what I want is if user is having Gmail app on his/her phone, then mail should be sent using it. If Gmail app is unavailable then the user should be redirected to Mailbox. So how can I know if user contains Gmail app and how can I redirect user to it. 回答1: You need to use custom URL Scheme. For gmail application its: googlegmail:// If you want to compose a message there you can add more parameters to this URL: co?subject=Example&body=ExampleBody You

Launch Google maps app from iPhone application.

点点圈 提交于 2019-11-30 10:18:24
I'm trying to launch google maps from my iPhone application. The launching part works fine but since the iPhone 3.1 update (i think it was around this time) I get a zoomed out map of the US and Canada rather than zoomed in on my current location. Everything worked fine originally but sometime around the update things stopped working correctly. Here is the string I've been using. This works on my partners phone with iOS 3.0 and our iPod with iOS 2.2.1 but on my phone with iOS 3.1 shows a zoomed out map of Canada and the US. NSString *name = @"clothing"; NSString *latlong = [[NSString alloc]

Check if my IOS application is updated

强颜欢笑 提交于 2019-11-30 08:11:49
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. tilo 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]; NSString *currentAppVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@

Keep a UIView or UIViewController on top of all others

北慕城南 提交于 2019-11-30 06:01:35
问题 I am subclassing UIApplication to intercept and display touches in my TouchDisplay view. I would like to extend the Application, Window, Delegate or Main ViewController in order to keep my TouchDisplay view on top of all other views. As my and most other applications work, views and controllers are added and removed all the time. I figure the correct answer will be able to deal with these additions and removals and stil keep the TouchDisplay view on top. Thanks for your help, Joe 回答1: Here

Getting a reference to the UIApplication delegate

半城伤御伤魂 提交于 2019-11-30 02:42:14
I'm writing my first iPhone application and I'm having trouble switching views. I have 2 views and a reference to each in the AppDelegate (an instance of UIApplicationDelegate ). I create instances of both in the applicationDidFinishLaunching and immediately show the first view. This works fine. The problem is the reference to the other view is in the AppDelegate and I can't figure out how to get a reference to it so I can switch to the other view. Is there a way to get a reference to the main UIApplication or UIApplicationDelegate objects? Louis Gerbarg Yes, UIApplication is a singleton, and