Error with objective c functions deprecated [duplicate] - objective-c

This question already has answers here:
presentModalViewController:Animated is deprecated in ios6
(5 answers)
Closed 8 years ago.
I'm trying to edit my source code on Xcode, but I keep getting an error.
Code:
// Present the mail composition interface.
[self presentModalViewController:picker animated:YES];
ERROR: 'presentModalViewController:animated:' is deprecated: first deprecated in iOS 6.0
Is there any way to fix this?

Typically, using deprecated features in any programming language may not work or may result in malfunctioning software.
Wikipedia defines deprecated as:
Deprecation is an attribute applied to a computer software feature,
characteristic, or practice to indicate that it should be avoided
(often because it is being superseded).
In short, you shouldn't be using presentModalViewController:animated:, and that's why you're getting the error.
http://en.wikipedia.org/wiki/Deprecation

Related

How to use Objective-C visualizer in Swift [duplicate]

This question already has answers here:
How do I call Objective-C code from Swift?
(17 answers)
Closed 2 years ago.
I am trying to implement audio visualizer to AVAudioPlayer from many days, tried different libraries but not succeeded. Now I found a library displayers but the problem is it's in Objective-C, now I don't know how to use it in the swift code. Here is the link of library https://github.com/agilie/DisPlayers-Audio-Visualizers. Please guide me in this regard or suggest me a good visualizer in Swift.
In order to use objective-c libraries or classes in a swift project you must use the bridging headers.
There's the apple documentation of importing this kind of project into a swift project:
https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift
If you're still stuck you should follow this tutorial:
https://medium.com/ios-os-x-development/swift-and-objective-c-interoperability-2add8e6d6887

How to deal with "Clang LLVM 1.0 error"? [duplicate]

This question already has answers here:
Xcode - OSX error: -fobjc-arc is not supported on platforms using the legacy runtime
(3 answers)
Closed 8 years ago.
So I am trying to run the code that I have written up from a tutorial however I have come across this problem. Could anyone help me out?
http://imgur.com/dPpUeBD
first off, the error you are getting is -fobjc-arc is not supported on platforms using the legacy runtime. clang is exiting with a return code of 1, which just means it failed (not sure where else you are getting the "1" from).
the reason you would get that error is because you are trying to build for some old system that doesnt support ARC. you dont even specify if this is iOS or Mac OS so giving you more of an answer is difficult.

Using deprecated methods [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Will Apple accept Apps with deprecated code?
I am developping an iPhone application and i am using a method like this :
- (NSString*)udid
{
UIDevice* device = [UIDevice currentDevice];
return [device.uniqueIdentifier stringByReplacingOccurrencesOfString:#"-" withString:#""];
}
But i have seen that the "uniqueIdentifier" is deprecated.The problem it's working fine, and i would like to know what's will happen if i will post my app in the store like this ( with the use of the deprecated method)
thanks for your answers.
In general, don't use deprecated apis, as they are liable to be removed from future versions. Also, APIs are generally deprecated because they are obsolete or sub-optimal, and there's usually a newer, better way of doing whatever you're trying to do.
In your case, definitely don't, for this reason:
http://gigaom.com/apple/apple-cracks-down-on-udid-use/
I believe the popular alternative is to create a UUID (which will be unique, but not tied to the device) on first run and save it to refer to on subsequent runs. It's been quite extensively talked about if you google it.

JavaDoc-like documentation for Objective-C in Xcode? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to do the documentation in objective C?
Is it possible to write class/method documentation in Objective-C in a way that Xcode 4 displays them in the quick help, and/or generates a doc document from it in the style of Apple's own documentation?
Displaying it live - not that I know of.
But as for generating Apple like documentation, the best I have found is appledoc which I've been using for a year now. If accepts a wide range of commenting styles including Javadoc styles and can generate very Apple like documentation which it can also install directly into your Xcode help system.
I don't know if it still works for Xcode 4 but for Xcode 3 you could generate API doc sets using doxygen.
Apple has a set by step guide: Using doxygen to Create Xcode Documentation Sets on how to do it.
There is also the appledoc tool available from GitHub. Makes nice docsets.

Problem in the last version of XCode (4) on Mac OSX [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Xcode 4 - The selected run destination is not valid for this action.
Hi everyone,
I'm currently learning Obj-C and I'm dealing with a book that provides a lot of sample xcode projects.
I've a problem when trying to run the code: it appears an alert saying "The selected run destination is not valid for this action".
This happen only in xcode 4+. In the old version all work fine.
Can you help me solving this? Thanks a lot.
I had this problem also.
You need to make sure the Base SDK is set correctly for the debug and release of you Application Target.
If its missing i.e 10.5 then you will get this message.
in my v4 of xcode it does not have a 10.5 sdk. But my Application Target was set to 10.5.
So I needed to change it to 10.6.
I did this by selecting the Targets Build settings of the Project.
and then changing the base SDK's there.