问题
I want to add features in my iPhone app:
- call to a phone number in my app
- play a recorded mp3 voice to that number
- after call ends, relaunch the previous app
I know I have to use following code snippet for dialing to a number XXXXXX:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:XXXXXX"]];
My be play record not worked, as my app will terminate when call dial launch. Is there any way to do this?
And, after the call ends or fails, will my previous app relaunch?
回答1:
Not possible (without jailbreak).
Once the iPhone is in a call your app will quit and you will not be able to play any sound. You can also not relaunch the app after the call - the user has to do that themselves.
回答2:
After the call ended/failed, your app will be relaunch.
My guess is that what you try to do is not yet possible. It might become possible with OS 4.0 but you should ask the question on the developer forum.
回答3:
Try this telprompt instead of tel like below modified code :
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt:XXXXXX"]];
Then it ll come back to app after call ends.this may help you..
来源:https://stackoverflow.com/questions/2818968/call-to-a-phone-number-through-iphone-app