Launch Settings from app? - ios4

Anyone know if it's now feasible to launch the 'Settings' app from your app? Google Maps does it when you don't have Location Services enabled and you try to locate yourself.
I've seen lots of folks post about it and most answers point to adding a bug in Radar.
In the wild, I know of two apps that show this dialog with ""Turn on Location Services to Allow [app] to Determine Your Location" along side Cancel and Settings buttons where the 'Settings' button will take you to the General Settings.
1) Facebook app version 3.3.2 that runs on iOS 3.1.3 shows this alert on start. I looked at the three20 source code in git-hub but that project is not really a full source of the app but more of a library with the app's components.
2) GroupMe also shows the same alert when adding current location to a new message.

You mean the settings of the app like you see in settings?
First create a settings.bundle in xcode>newfile>settings.bundle.
This will create some prop lists that you can edit from out of the Settings.app or your app self. For the exact code Google can help you a lot further that I can. If you have any specific questions; don't hesitate to ask.

In iOS 5.0 you can open settings using the "prefs://" URL scheme. But in iOS 5.1 it doesn't work. But there is a trick I used for login twitter account using settings inside my app. the code is
TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];
// Create the completion handler block.
[tweetViewController setCompletionHandler:^(TWTweetComposeViewControllerResult result)
{
[self dismissModalViewControllerAnimated:YES];
}];
// Present the tweet composition view controller modally.
[self presentModalViewController:tweetViewController animated:YES];
tweetViewController.view.hidden = YES;
for (UIView *view in tweetViewController.view.subviews){
[view removeFromSuperview];
}
Using this code you can switch to settings from your app directly if you are not already logged in twitter account.

Related

Navigating to a specific view from appdelegate using xamarin.ios and mvvmcross

I am working on a cross platform app using xamarin and MVVMcross.
I want to navigate to Login page when the app is in background for a specific amount of time.
I was successfull in implementing the same in android but wasn't able to find a proper solution in ios for this where MVVMCross is used.
Below is my Android code which is working
Intent intent = new Intent(this, typeof(LoginView));
var viewModelRequest = new MvxViewModelRequest(typeof(Core.ViewModels.LoginViewModel));
var serializer = new MvvmCross.Core.Parse.StringDictionary.MvxViewModelRequestCustomTextSerializer();
intent.PutExtra("MvxLaunchData", serializer.SerializeObject(viewModelRequest));
StartActivity(intent);
I need to implement the same in ios. I know I need to write a similar code like in android in WillEnterForeground method of Appdelegate but wasn't able to find a proper solution for it anywhere.
Is WillEnterForeground the right place to do this ?
Can someone please help
I was able to go one step ahead
var view = (IMvxIosView)UIStoryboard.FromName("Tasks", null).InstantiateViewController("LoginView");
var viewController = view.CreateViewControllerFor(viewModelRequest) as UIViewController;
Window.RootViewController = new UINavigationController(viewController);
Window.MakeKeyAndVisible();
Now I am able to get to the login screen when the app comes in foreground again.
But when I click the Login button nothing happens.
Just for more information i am using Storyboards and have overridden CreateIosViewsContainer method of MvxIosSetup in my Setup class.
Any help please as I am relatively very new to ios development?

Universal Link for IOS is not working

Hi I have done with following steps to implement Universal Link for IOS.
1.My sub domain is npd.nowconfer.com, and my apple-app-site-association file contains,
{
"applinks": {
"apps": [],
"details": [
{
"appID":"R3UDJNSN2P.com.sampleUniversal.teledna",
"paths": ["*"]
}
]
}
}
this file is uploaded into my subdomain npd.nowconfer.com and its serveing over https.
2.I tested using AASA Validator i.e https://branch.io/resources/aasa-validator/#resultsbox and i got Test result as all pass.
you can see attached screenshot.
3.Now In app side,my colleague did configuration such as
Added the domain to Capabilities i.e applinks:nowconfer.com and applinks:npd.nowconfer.com
Handled Universal Links in app i.e in delegate like this
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
NSURL *url = userActivity.webpageURL;
// handle url
}
4.my universalink is https://npd.nowconfer.com:5000/calendar/deeplink?url=nowconfer when i click on this link from email ,my app is not opening instead it is redirecting to app store(becasue server side request came handling to redirect app shore if app is not installed on device)
But when i tested universalink validator here https://search.developer.apple.com/appsearch-validation-tool ,i have got some error
Link to Application : Error no apps with domain entitlements
The entitlement data used to verify deep link dual authentication is from the current released version of your app. This data may take 48 hours to update.
I have seen lot of tutorials but not used anything for me.Can you guys help me to figure out what is happening here?
Universal Links have to be standard http:// or https:// links. This means they need to use the standard web ports, of which 5000 is not one. That is why your link is not working — it's not actually a valid Universal Link.
The Apple validator checks for some additional things, and is also somewhat unreliable. This particular error message is confusing, but it has nothing to do with whether your Universal Linking configuration is correct. What it actually means is Apple can't detect applinks: entitlements and 'proper' handling of passed-in link values in the version of your app that is currently live in the App Store. This is expected if you are just implementing Universal Links for the first time. You don't need to worry about this — a number of large and successful apps with working Universal Links implementations fail this step too.

iOS8 Location: How should one request Always Authorization after user has granted "When In Use" Authorization?

When my app launches the map view, I request the iOS8 "When In Use" location permission. Assume user grants that.
I would like to request the Always permission only when user opts-in to my geofencing feature. But calling CLLocationManager.requestAlwaysAuthorization has no effect because the current authorization status is no longer kCLAuthorizationStatusNotDetermined.
How would one go about requesting the Always permission AFTER user has granted When In Use permission? I would think this is a common use case because apps should avoid asking for the Always permission unless needed.
You are right, calling requestAlwaysAuthorization will not do anything if the user already granted 'when in use' permission. A workaround I used was to link the user to the settings screen and let them turn on the 'Always' setting themselves. Here are the steps to do that:
Create a new key in your app-Info.plist called NSLocationAlwaysUsageDescription and enter some reasons as to why you need to request the always permission in the value field.
Link your user to your app's settings screen (more info here)
NSURL *settings = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if ([[UIApplication sharedApplication] canOpenURL:settings])
[[UIApplication sharedApplication] openURL:settings];
Once the user taps your link they will see this:
and when they click on Location, they will be able to see both While Using the App and Always settings to choose from:
Monitor authorization changes in your app by implementing the CLLocationManager delegate method locationManager:didChangeAuthorizationStatus:
I don't know about objective-c, but it works fine for me in swift and iOS 8.4. Make sure you provide both keys in your info.plist
NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
// iOS 11 and up will require this key instead of AlwaysUsageDescription
NSLocationAlwaysAndWhenInUsageDescription
Then just call
locationManager.requestAlwaysAuthorization()
And make sure locationManager is an instance variable! A local variable will be ignored for some strange reason.
Apple Documentation

UIWebView Loading content properly on iOS 6 simulator but not on device?

I have encountered a weird bug with a released app. My UIWebView is no longer loading content on iOS 6, yet the content still displays in the simulator. The activity indicator displays properly but then it loads a blank url? Again, this only happens on a device, not on the simulator.
To provide extra context (in the simulator the NSURLRequest is assigned the proper URL. When run on a device the value is nil.)
Here is my code :
-(void)loading
{
if(!self.webView.loading)
[self.activityIndicator stopAnimating];
else {
[self.activityIndicator startAnimating];
}
}
- (void)viewDidLoad
{
[self.webView addSubview:self.activityIndicator];
NSURLRequest *requestUrl = [NSURLRequest requestWithURL:self.url];
[self.webView loadRequest:requestUrl];
self.timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:#selector(loading) userInfo:nil repeats:YES];
[super viewDidLoad];
NSLog(#"%#", requestUrl);
}
I had a similar issue with our web app (HTML+JS+CSS) not loading on a device, but working fine in a browser and iPhone Simulator. The cause of the issue was the wrong case in filenames. E.g., HTML file wanted to load a file 'Loader.js', whereas its name was 'loader.js'.
So, maybe you should check your 'self.url' (if your 'index.html' has the right case in its filename).
please use web view in nib and debug it to safari developer tools,
so you can trace the actual problem. I use this approach for my application and its working.
process to open developer tools
1-open safari
2-go to preference
3-go to advance option
4- set on to developer tools
After follow above process you can see your safari having option develop.
it means your safari developer tools is active and you can able to debug ios application

Publishing Check-in via Facebook IOS SDK

I'm trying to publish a check-in on a users wall. I don't need to get the longitude and latitude of the users device. But rather have this static as well as the place the user will check-in too. Basically a "check-in" button that already has static coordinates and a message.
I got the demo app up and running but can't seem to find any step by step tutorials on this particular topic. Is there any link around or a sample project you can point me to?
Thanks!
First, you need to have a place id. Assuming you have that you can use the Facebook Graph API to make a feed post to check-in the user.
You can do something like this (using Facebook iOS SDK 3.0):
[FBRequestConnection startForPostStatusUpdate:#"Awesome place!"
place:#"110506962309835"
tags:nil
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
//verify result
}
];
Or:
[FBRequestConnection startWithGraphPath:#"me/feed"
parameters:#{#"place":#"110506962309835"}
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
//verify result
}];
You will need to ask the user for publish_stream permission before making this call.

Resources