I across the following code:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel://8005551212"]];
on : Making phone calls on iPhone
But, it does not work for me in the simulator.
I have connected the IBAction(callphone) to the ViewController(TouchUpInside). I am now not sure, is it because I am checking my code in simulator? I do not get a dialog box. Please advice.
I tried putting log statements and the action does get called since the log stamtments that I wrote to test is being printed
Can you make a phone call from your Mac? No. That's why the simulator doesn't work when you try to open a tel:// URL. You must do this from a device that can make a call: an iPhone, but not an iPad or iPod touch.
Related
I use MKMapView it works fine on iPhone, iPad and simulators but in iPod it crash when i second time enter in the view(first time it work fine). I have tried this but it is not work for me:
-(void) backButtonAction
{
[_mapView setDelegate:nil];
[self.navigationController popViewControllerAnimated:YES];
}
When I try to execute the code on an iPod(go second time on view) .I get an error ( EXC_BAD_ACCESS(code=EXC_ARM_DA_ALIGN,address=0x494f6055) )
By this solution didUpdateUserLocation method is not called and you are not able to get user location internally from didUpdateUserLocation method but until Apple not fixes it.This is the only solution i got from the link EXC_BAD_ACCESS at lauch for EAGLContext renderbufferStorage: fromDrawable: in Cocos2d app whie debugging
which i do and remove the crash.
In Xcode, go to Product -> Scheme -> Edit Scheme ... And for the Run Debug configuration (on left side) choose "Options" (on right side) and configure "GPU Frame Capture" as Disabled.
In my iOS 7+ app I'm using the latest version of Harpy, which perform an app version check and present an alert if there's a new version of my app available in the App Store.
Due to the structure of my app, I'm facing this issue in the debugger:
Attempt to present <UIAlertController: 0x144538530> on <DCLoginViewController: 0x14460c1a0> whose view is not in the window hierarchy!
this is because harpy is configured in the AppDelegate and has a parameter that define the presentingViewController:
[[Harpy sharedInstance] setPresentingViewController:_window.rootViewController];
I believe the issues arise because my app check if the user is already logged in, if so, instead of presenting the DCLoginViewController, it jumps to the next view which is "LoadingViewController".
How can I set the presentingViewController to be this LoadingViewController or even the ViewController currently on screen at execution time?
Thanks for your help.
You don't have to launch Harpy in the AppDelegate. You can launch it after LoadingViewController has loaded. It's only recommended to launch it in the AppDelegate as the idea is to show the alert as soon as the app is loaded. It's more of a UX thing than anything else.
There is a small bug in my App.
My App displays notifications at specific times when the App is running and cancel all of them whenever a button is switched.
My problem is that whenever a user closes the App using the multitasking feature of iOS the notifications are still showing up.
I tried to add the following code which doesn't work:
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
[[UIApplication sharedApplication] cancelAllLocalNotifications];
}
The problem is that my App should show notifications when the App is running but shouldn't show notifications when the App is terminated.
Why does the above code not work?
The correct answer is that this cannot currently be done by a multitasking app. One solution is to set a flag in our info.plist declaring your app wants to be killed when the user switches to another app - then you will get the willTerminate message (but get killed then).
There are huge numbers of threads on this topic, one which quotes an Apple doc that tells you backgrounded apps that are terminated do NOT get the willTerminate message is here.
For me, this just means I can now close an open bugreport out with a 'cannot fix' resolution :-)
Just because your app is visible in the app-changer, it doesn't mean it is still running.. it can get closed at any point. You cannot differentiate between the OS closing your app or the user closing your app.
Perhaps a button would be the solution? A button that cancels all notifications?
Or you run a real background task (which can last for about 5 minutes) and stop all notifications afterwards. Or you just schedule the notifications for the next 5-10 minutes and that's it.
For what are you using them?
I'm working on a big project with many view controllers. Progression through these views depends on data being filled in on lengthy forms.
In my not-so-clever way i'm autofilling data so that i can speed through to the current feature I'm working on. I was using a conditional like this...
if(
[[[UIDevice currentDevice] name] hasPrefix:#"Rob"] ||
[[[UIDevice currentDevice] name] hasPrefix:#"iPad Simulator"]
)
{
self.label.text = #"xxx";
...
}
...this worked great because I could test both on my iPad and in the simulator. Now the client wants to also be able to test on their simulator, so I can't leave my autofill in. I'm thinking the simplest solution would be to just change the name of the simulator.
In Settings.app on the simulator, it's not editable. I also haven't seen then text "iPad Simulator" or "Simulator" show up in any files in ~/Library/Application Support/iPhone Simulator/5.1. I've done searches on setting plist properties, but no luck.
Does anyone know how to accomplish this?
You'll be able to check if it's running the iPhone Simulator by checking the model rather than the name of the current device. Something like the following should do:
if ([[[UIDevice currentDevice] model] isEqualToString:#"iPhone Simulator"]) {
// Run for iPhone simulator
}
Note: You'll need to use "iPad Simulator" for when you use the iPad Simulator
Also, your current code with hasPrefix is not secure at all. Rob is a common name so if someone else has a device with the name of their device beginning with Rob then it'll expose your test information. I highly suggest you just target this autocomplete for the simulator only
Just create a new class and put your loading logic there.
After that, call this class from your delegate didFinishLaunchingWithOptions method.
With this, you can comment the above call whenever you want or better, check if the data is already loaded and ignore it.
I want to dial a number from IPhone simulator for India. I have tried this on a button click:
-(void)makeaCall
{
NSURL *phoneNumber = [[NSURL alloc] initWithString: #"tel:1-800-180-2222"];
[[UIApplication sharedApplication] openURL: phoneNumber];
}
But it's not showing any action of dialing any number.
Please help me with this.
you can't make a phone call from the simulator you will need a real phone for that.
but you can simulate an incoming call by selecting Hardware > Toggle In-Call Status Bar. also the incoming call should trigger in the app delegate the method applicationWillResignActive.
You might have to try that on a real phone, the simulator is a simulator after all and might not be able to make calls.