This question already has answers here:
Phone call number with hashtag on iOS
(3 answers)
Closed 4 years ago.
In iOS i want to call calling dial pad when I am tried to a normal number and using + and - symbols then it's working good, but when I am trying to add * and # Tag then call dial is not open. Please give me solution how can i do this
Here is My CODE
NSString *phoneNumber = [#"tel://" stringByAppendingString:#"*123*12335553#"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
Please replace your character : [<your string> stringByReplacingOccurrencesOfString:#"*" withString:#""]; from your string.
Related
This question already has answers here:
remove unwanted characters in iOS
(4 answers)
Closed 6 years ago.
I bumped into an interesting situation while I am writing an application about contact list.
The weird situation is that after I successfully managed to retrieve contacts from the iPhone's list, some phone numbers listed as;
#"\U0000202a xxx xxx xxxx\U0000202c".
When I try to use;
modifiedPN = [modifiedPN stringByReplacingOccurrencesOfString:#" " withString:#""];
and
modifiedPN = [modifiedPN stringByReplacingOccurrencesOfString:#"\\U0000202" withString:#""];
nothing changes.
I also tried
[mPN containsString:#" "]
and
[mPN containsString:#"\\U0000202"]
but they both returns "NO"
I think this problem occurs when user was saved from Whatsapp.
Does anyone know how to fix this issue?
I only want the phone number without spaces or weird \U0000202 charachter.
Go the other way and extract the number:
NSString *numString = #"\U0000202a 123 456 7890\U0000202c";
NSString *extractedString = [[numString componentsSeparatedByCharactersInSet:
[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]
componentsJoinedByString:#""];
// extractedString = 1234567890
This also works with (123) 456 7890
This question already has answers here:
convert NSTaggedPointerString to NSString
(5 answers)
Closed 6 years ago.
It's about a Get network request, for more information please see this pic.
I want to get the argument "pilotCode", but its value is "0xa00006e....", I want to get its real value which is "admin", please tell me what should I do?
Thank you very much.
I solved this problem just now.
just add this code:
"NSString *realStr = [NSString stringWithString:pilotCode];"
This question already has answers here:
Release a NSMutableArray when using ARC
(2 answers)
Closed 9 years ago.
I have a string that I generate with JSON data from an URL
NSString *strResult = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
This code is inside viewDidLoad method. I want to release the string before I exit the method to avoid any memory leak, and I do this according to this post.
[strResult release];
However, xCode does not allow me by giving error: ARC forbids explicit send message of 'release'.
Anybody knows why? I tried to google it but no luck. I am new to iOS programming, and I have tried to google it before I asked. So any help will be appreciated.
ARC automatically adds the methods to deallocate objects, at compile time, for you.
This question already has answers here:
Getting current device language in iOS?
(33 answers)
Detect language in use by iOS application
(2 answers)
Closed 9 years ago.
I'm very new to iOS and Objective-C and I've been working on a project for an SMS app in which the app contains a text box for the message and that box has a counter for the characters but the counter depends on the language of the text, so my question is how can I identify/detect what language is the user using?
You can get user's prefered language list by using NSLocal:
NSString * language = [[NSLocale preferredLanguages] objectAtIndex:0];
if ([language isEqualToString:#"en"]) {
NSLog(#"user's prefered first language is English");
}
NSString * language = [[NSLocale preferredLanguages] objectAtIndex:0];
Have a look at this: Getting current device language in iOS?
This question already has answers here:
How do I URL encode a string
(24 answers)
Closed 9 years ago.
I am trying to URL encode an NSString but I can't seem to find the proper way (I'm new to Obj C). I have been searching around but can't find a decent answer. So:
What is the correct, and modern, way to encode an NSString like a URL?
Thanks in advance.
Encoding to UTF-8:
NSString *strUTF8 = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];