How to check iOS 10 deprecated methods in Xcode 8? - objective-c

My app uses UIUserNotificationSettings, which I noticed is deprecated in iOS 10. However Xcode isn't displaying a Buildtime deprecation error for this method. How can I make Xcode display these newly deprecated methods?

You're not seeing deprecated warnings because you're likely targeting an OS that's pre-10.0. If you wanted to see the warnings, change your deployment target to 10.0 and the 10.0 deprecation warnings will appear.

Related

import CallKit crashes randomly on iOS 9

I have imported CallKit framework as optional only. But import CallKit crashes while running on iOS 9 at launch. But works perfectly on iOS 10.
It worked fine in XCode 8 beta 6 but this issue is happening only on XCode 8.
The code is in Swift 3.
Any help is much appreciated.
CallKit API is only for iOS 10.0+. It won't work for iOS 9.0. Use a condition for iOS version 9.0 and 10.0 to avoid the crash.
Reference : https://developer.apple.com/reference/callkit?language=objc
There is/was a bug in Swift 3 language that wrongly links module libraries github pull request, that is fixed now, but the fix is not yet implemented in XCode, not even in beta.
You could get latest swift toolchain build from link and install it to XCode to try and see the fix, but the app would not be approved for Appstore as it's stated here
You got two solutions;
wait for apple to release XCode with new version of swift 3.0.2+
or revert your code back to swift 2, where it works, with "Use Legacy Swift Language Version" flag in Build Settings
If you choose to revert back to swift 2, brace yourself with a lot of patience :D

Xcode 6 beta 5 won't build Swift with iOS 7.1 SDK

Despite the release notes stating this is supported and previous version of Xcode 6 working ok, I have a rather verbose error message when trying to build with 7.1 SDK.
"iOS targets using Swift cannot be built against an SDK older than 8.0, but the effective SDK is 7.1."
Has anyone else seen this?
I just had this issue, but with the app store build of Xcode 6.0.1 (6A317).
The issue was that I had copied old SDK's (7.0, 7.1) into the Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs directory. This was causing Xcode to use the wrong SDK for building.
Deleting them solved this problem for me. That'll teach me for mucking around with Xcode.

Turn Deprecation Warnings Back On

After creating a new target in an iOS project, there are tons of deprecation warnings. I want to see these in the other targets, too.
I've searched my whole project for deprecated (as this answer would indicate) and I've also looked for -W (as mentioned here), and found that I did do this:
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
in one or two places, but that's not it. I've looked at most answers regarding suppressing warnings, but I haven't found where I shut this off.
Where else might deprecation warnings been shut off? I would like to turn my warnings back on.
Example
This should result in a warning:
self.numericLabel.lineBreakMode = UILineBreakModeClip;// NSLineBreakByClipping;
Because comments are folded up by default and sometimes get missed, I am elaborating on Greg's comment with an example.
Deprecation warnings are only printed if your Deployment Target is newer than the first deprecation of the API.
Example 1:
Using: [TWTweetComposeViewController canSendTweet]
Deprecation in Apple's document:NS_DEPRECATED(NA, NA, 5_0, 6_0)
Deployment Target: iOS 5.0
iOS SDK: 6.1
Warning: No
Example 2:
Using: [TWTweetComposeViewController canSendTweet]
Deprecation in Apple's document:NS_DEPRECATED(NA, NA, 5_0, 6_0)
Deployment Target: iOS 6.1
iOS SDK: 6.1
Warning: Yes
In Example1, the apple's deprecation document states that the api was introduced in iOS 5.0 and deprecated in iOS 6.0. So although my iOS SDK(xcode) was 6.1, I was not getting any warning since my deployment target was iOS 5.0 which would need that api.
In Example2, I changed my deployment target to iOS 6.1 and the warning started appearing.
Conclusion: Deployment target is generally the lowest iOS version that you want your app to support. If you set that to a version that's subsequent to the deprecation of an API, the warnings start showing up in Xcode

ABPeoplePickerView Warning NSImage compositeToPoint:operation:] is deprecated in MacOSX 10.8

Using Mac OS 10.8.3 and xCode 4.6.1 and using ABPeoplePickerView with a very simple Cocoa App with XIB using ABPeoplePickerView results in an run time warning coming from ABPeoplePickerView:
2013-04-02 21:58:36.848 AddressbookTest[4462:303] ** WARNING: -[NSImage compositeToPoint:operation:] is deprecated in MacOSX 10.8 and later. Please use -[NSImage drawAtPoint:fromRect:operation:fraction:] instead.*
but I cannot change a class crCeated by Apple itself. A Apple bug? Any workaround to avoid this or simple ignore the runtime warning?
Just ignore it. If you want to harass the Address Book team about it, use bugreport.apple.com, but it's not necessary.

Warning in XMPP classes on iOS 6

I am getting multiple warnings when I am trying to run my XMPP chat client on iOS 6
'dispatch_get_current_queue' is deprecated: first deprecated in iOS 6.0
Not sure how to fix these warnings. Is updated XMPP framework available for objective C compatible with iOS 6?
This was reported at the project page:
https://github.com/robbiehanson/XMPPFramework/issues/115
https://github.com/robbiehanson/XMPPFramework/pull/140
Someone uploaded a patch. Either give that a try, or just live with the warning until the patch is accepted.
You can fix the warning in the XMPPFramework with this line:
NSAssert(dispatch_get_specific(moduleQueueTag), #"Invoked on incorrect queue");