cString is Deprecated? [duplicate] - ios

This question already has an answer here:
NSString cString is Deprecated. What is the alternative?
(1 answer)
Closed 9 years ago.
I don't know where to turn to figure this out so I'm turning to you guys, the BEST! I'm new to objective c.
I get the deprecated warning with the following line of code. Any ideas on how to make this compatible with iOS 6?
const char *pUrl = [tStr cString];
Thanks so much!

As per the relevant documentation, this has been deprecated since iOS 2.
(Deprecated in iOS 2.0. Use cStringUsingEncoding: or UTF8String instead.)
As such, you need to either use the cStringUsingEncoding or UTF8String approaches instead.

Related

Refactoring the swift code [duplicate]

This question already has an answer here:
What is other option available in swift instead of refactoring and renaming class or attribute name?
(1 answer)
Closed 6 years ago.
I am working on swift project.After 1 month I need to refactor the code as we have done in objective c. I need to change some class names, properties and method names. But problem is that when I go to refactor the code but It showing me an error.
Error is "Xcode can only refactor C and Objective-C code."
Is there any way to refactor the code because there are 50+files to change the code.
Thanks in advance
Unfortunately, no. We're stuck with "Find>Find & Replace in Project".

Strange autocompletion happening in Xcode 7.3 [duplicate]

This question already has answers here:
Using a dispatch_once singleton model in Swift
(30 answers)
Why does the suggested Swift singleton implementation use a struct?
(2 answers)
Closed 6 years ago.
When I update the Xcode to 7.3,something strange happens.
How can I fix it ?
It is much simpler in swift, just do this:
static let sharedMenu = KxMenu()

Swift: create module (namespace) [duplicate]

This question already has answers here:
How to use Namespaces in Swift?
(9 answers)
Closed 5 years ago.
Hy guys,
Do you know how can I create a module(namespace) in swift ? For example in C# we have namespace keyword, but in Objective-C there is no such thing, there we named our classes with the prefix of the folder they were located in. Shall I use the same approach in swift or do you know some other way to achieve namespacing in swift.
Thank you!
You can achieve it by using Frameworks which is newly introduced in iOS 8 for namespace-ing, if I am not mistaken.
I think I will either rename my classes to have a prefix of two capital letters like NSString, UIView and other classes from Objective-C do or I will wrap them in structs.
Thank you for your comments.

how do i change an old project I had so it can use ARC? [duplicate]

This question already has answers here:
How to automatically convert Manual Retain-Release code to ARC?
(2 answers)
Closed 9 years ago.
I started an old project in an xcode that did not support ARC, how can I change my project into using ARC and how do I know what to remove from the project?
In Xcode, Edit => Refactor => Convert to Objective-C ARC... and follow the instructions.

How to change to use ARC from nonARC project? [duplicate]

This question already has answers here:
How do you enable ARC project-wide in Xcode 4.2
(3 answers)
How to automatically convert Manual Retain-Release code to ARC?
(2 answers)
Closed 9 years ago.
I have an project in nonARC mode. How to change it to ARC mode without create new project?
Is there any auto convert method, library or way?
I also want auto delete release,autorelease and change some text(retain -> strong,...)
This screen shot will help you
Read this DaveOnCode and Migrating your code to Objective-C ARC.

Resources