我有一个紧急呼叫应用程序。当用户按下联系人时,它会呼叫他们。然后用户必须返回应用程序发送自动短信。但是,我希望当按下联系人时,用户会被带到消息框架,一旦按下发送,它就会呼叫该人。这是到目前为止的代码。
- (NSString *)deviceLocation {
return [NSString stringWithFormat:@"Hi, you have been contacted as there has been an emergancy. Here is the location of the caller: Latitude: %f Longitude: %f . Please call for help to that location. From Kiddy Call the iPhone app. ", locationManager.location.coordinate.latitude, locationManager.location.coordinate.longitude];
}
#pragma mark - PictureListMainTableCellDelegate methods
-(void)pictureListMainTableCell:(PictureListMainTableCell *)cell wantsToCallNumber:(NSString *)number
{
if([MFMessageComposeViewController canSendText])
{
MFMessageComposeViewController *messageComposer =
[[MFMessageComposeViewController alloc] init];
NSString *message = (@"%@", [self deviceLocation]);
[messageComposer setBody:message];
messageComposer.recipients = [NSArray arrayWithObjects:number , nil];
messageComposer.messageComposeDelegate = self;
[self presentViewController:messageComposer animated:YES completion:nil];
NSLog(@"Texting telephone number [%@]", messageComposer);
}
NSString *urlString = [NSString stringWithFormat:@"tel://%@", number];
NSLog(@"calling telephone number [%@]", number);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
NSLog(@"%@", [self deviceLocation]);
}
对此的任何解决方案将不胜感激。