-1

i want to call forwarding in this code:

    NSString *phone =@"**21*08150815#";
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phone]];
[[UIApplication sharedApplication] openURL:url];

but not working.What is the problem? Can you help me?

AlimYldz
  • 1
  • 2

1 Answers1

1

I think you need a "//" after the ":"

NSString *phone =@"**21*08150815#"; 
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",phone]];
[[UIApplication sharedApplication] openURL:url];
Max Chuquimia
  • 7,494
  • 2
  • 40
  • 59
  • No. [`tel:` urls](https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/PhoneLinks/PhoneLinks.html) don't need slashes. The problem is that iOS restricts the use of openURL to regular telephone numbers. You can't use service codes in them. – Matthias Bauch Feb 12 '14 at 09:21
  • This code is not working.i used both technique but does not worked.i m using sdk 7.0 so service is not coming to output.i m taking in log all numbers truly but not executing. – AlimYldz Feb 12 '14 at 15:35