xcode 6.1.1 doesn't compile: AFNetworking/AFURLConnectionOperation.m:455:9: Use of undeclared identifier '_cancelled' - xcode6

I have a working project already in App Store, today I've upgraded Xcode to 6.1.1 and compiled my project and got the following error:
AFNetworking/AFURLConnectionOperation.m:455:9: Use of undeclared identifier '_cancelled'
AFURLConnectionOperation is derived from NSOperation in which the cancelled property is defined like so:
#property (readonly, getter=isCancelled) BOOL cancelled;
- (void)cancel;
In xcode 5.1.1 the parameter was recognized and for some reason in xcode 6 (with support of ios 8) it's no longer recognizing it's parent property
suggestions?

Related

Xcode 11 debugger crashes on breakpoint, can't find Foundation.h

My macOS app compiles and runs fine, but since switching to Xcode 11, I can no longer debug from breakpoints. The debugger always crashes with a bunch of messages like this:
warning: Swift error in scratch context: /foobar/Foo-Bridging-Header.h:14:9: note: in file included from /foobar/Foo-Bridging-Header.h:14:
#import "TPPreciseTimer.h"
^
error: /foobar/Timer/TPPreciseTimer.h:9:9: error: 'Foundation/Foundation.h' file not found
#import <Foundation/Foundation.h>
^
/foobar/Timer/TPPreciseTimer.h:9:9: note: did not find header 'Foundation.h' in framework 'Foundation' (loaded from '/System/Library/Frameworks')
#import <Foundation/Foundation.h>
^
error: failed to import bridging header '/foobar/Foo-Bridging-Header.h'
.
Shared Swift state for Foo has developed fatal errors and is being discarded.
REPL definitions and persistent names/types will be lost.
Message from debugger: The LLDB RPC server has crashed. The crash log is located in ~/Library/Logs/DiagnosticReports and has a prefix 'lldb-rpc-server'. Please file a bug and attach the most recent crash log.
Anyone know a workaround for something like this?
My coworkers still on Xcode 10.3 are not having this issue with the same codebase.
Same here. Removing /Users/{user}/Library/Developer/Xcode/DerivedData directory helped.

How do I use IBDesignable/IBInspectable with CocoaPods in an Objective-C only project

My project is Obj-C only. Via Cocoapods, I tried installing an Obj-C library that takes advantage of IBDesignable and IBInspectable. If I add that project to my library and run 'pod install' I get two errors when building/running:
error: IB Designables: Failed to update auto layout status: Failed to load designables from path (null)
error: IB Designables: Failed to render instance of PKCircleProgressView: Failed to load designables from path (null)
Ok, so apparently to take advantage of IBDesignable/IBInspectable, your code needs to be in a framework, not a static library. It seems that all I need to do then is add this to my Podfile:
use_frameworks!
When I do that, I'm able to see everything in Interface Builder, but when I build/run, it can't find AFNetworking.h. I don't think the error is specific to AFNetworking, it's just the first pod in my Podfile.
If I was using Swift, it seems like the answer is that I need to add all the libraries from my Podfile into my Swift/Obj-C bridging header.
Even though I'm not using Swift, do I still need to create a bridging header?
Here's my Podfile (without the DownloadButton pod, and without use_frameworks!):
platform :ios, '8.0'
pod 'AFNetworking'
pod 'FMDB'
pod 'HKCircularProgressView'
#pod 'Taplytics'
pod 'PAPreferences'
pod 'HTMLLabel'
pod 'IDMPhotoBrowser'
pod 'MBProgressHUD'
link_with 'Langham', 'Leela', 'Las Alcobas', 'Siam', 'AKA BH', 'Ritz Montreal', 'Fullerton', 'Fullerton Bay'
# Fix broken copy-resources phase per https://github.com/CocoaPods/CocoaPods/issues/1546
post_install do |installer|
installer.pods_project.targets.each do |target|
scriptBaseName = "\"Pods/Target Support Files/#{target.name}/#{target.name}-resources\""
sh = <<EOT
if [ -f #{scriptBaseName}.sh ]; then
if [ ! -f #{scriptBaseName}.sh.bak ]; then
cp #{scriptBaseName}.sh #{scriptBaseName}.sh.bak;
fi;
sed '/WRAPPER_EXTENSION/,/fi\\n/d' #{scriptBaseName}.sh > #{scriptBaseName}.sh.temp;
sed '/*.xcassets)/,/;;/d' #{scriptBaseName}.sh.temp > #{scriptBaseName}.sh;
rm #{scriptBaseName}.sh.temp;
fi;
EOT
`#{sh}`
end
end
Correction
IBInspectable and IB_DESIGNABLE are not Swift related. They can be used in either Swift or Objective-C. It's a matter of iOS version, and occasionally of setting the Module in IB.
Real life Example
iOS 7 does not support IBInspectable, so use the .7 class for both controls. If your project targets iOS 8+, you should use TGPDiscreteSlider & TGPCamelLabels instead
Create a base class for iOS 7 (prior IBInspectable)
#interface TGPCamelLabels7 : UIControl...
#property (nonatomic, assign) CGFloat ticksDistance;
#property (nonatomic, assign) NSUInteger value;
// ...
Create a child class for iOS 8
#interface TGPCamelLabels : TGPCamelLabels7
#property (nonatomic) IBInspectable CGFloat ticksDistance;
#property (nonatomic) IBInspectable NSUInteger value;
// ...
In this manner, your Pod can be used in either mode.
It has been solved, in details, on this TGPControls Pod.
Download the project, you will find 2 examples Xcode projects, one for Swift, 1 for Objective-C.

Auto synthesis error in AFURLRequestSerialization with Xcode 6

How do I fix the warning "auto property synthesis will not synthesize because it is readwrite but it will be synthesized readonly via another property" for the properties streamStatus and streamError that I'm getting with the latest AFNetworking on the Xcode 6 beta?
https://github.com/AFNetworking/AFNetworking/blob/master/AFNetworking/AFURLRequestSerialization.m#L733
Here's the relavent line in AFURLRequestSerialization.m line 733 and 734:
#interface AFMultipartBodyStream () <NSCopying>
#property (readwrite, nonatomic, assign) NSStreamStatus streamStatus;
#property (readwrite, nonatomic, strong) NSError *streamError;
It seems like the version of clang that ships with xcode 6 beta doesn't authorize to rewrite properties in an extension that is not a direct extension of the original class holding those properties.
removing:
#property (readwrite, nonatomic, assign) NSStreamStatus streamStatus;
#property (readwrite, nonatomic, strong) NSError *streamError;
and replacing it with :
#interface NSStream ()
#property (readwrite) NSStreamStatus streamStatus;
#property (readwrite, copy) NSError *streamError;
#end
solves the issue.
I've opened a pull request in the AFNetworking repo to solve this.
Hope this helps.
I JUST set up my Xcode 6 to work with developing iOS 7 apps, and it fixed an autosynthesis issue I was having with AFNetworking. I changed my build tools to 5.1 and moved the 7.1 SDK into the Developer/SDKs dir in Xcode 6. The issue (obviously) is that I need to change the build tools when working on iOS 8 explicitly, but it's much better than switching back and forth between 5 and 6.
Changing Build Tools
Open Xcode Preferences (cmd+,)
Navigate to the 'Locations' tab
Change 'Command Line Tools' from Xcode 6.0 to Xcode 5.1.1
Getting iOS 7 SDK
Open Terminal
Run cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk /Applications/Xcode6-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
Restart Xcode
You should now be able to set iOS 7.1 as your base SDK
This should solve your issue in the short term until all of these libraries are updated for iOS 8.0 and the new build tools.

Using UIStatusBarLightContent for iOS6 compatible app crashing

I have an app the I built in iOS7 but am trying to compile it for iOS6. My settings are Base SDK 7.0 and Deployment Target 6.0, however this line of code is causing the app to fail build:
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
It says that its a use of undeclared identifier. How do I get around this?
The value of lightContent is
UIStatusBarStyleLightContent NS_ENUM_AVAILABLE_IOS(7_0) = 1
to get it to build in ios6 you can replace the value with 1. It isn't very clean but it is simple.
#ifndef UIStatusBarStyleLightContent
#define UIStatusBarStyleLightContent 1
#endif
would also work but is just as hackey.

duplicate error in xcode with sharekit on phonegap (but not with phonegap-plugin)

I have a xcode/phonegap project where I want to use the sharekit - not as phonegap-plugin but from inside the objective-c code, so no need to implement the phonegap plugin version of the sharekit.
I import the sharekit classes and want to compile but there is an error telling me that the reachability class is defined twice: one inside phonegap and one inside sharekit.
ld: duplicate symbol _OBJC_IVAR_$_Reachability.reachabilityRef in
/Users/Shared/PhoneGap/Frameworks/PhoneGap.framework/PhoneGap and
/Users/Username/Library/Developer/Xcode/DerivedData/Appname-cjsfgpsrurmznybczdgqiotrctnm/Build/Intermediates/Appname.build/Debug-iphonesimulator/AppnameID
.build/Objects-normal/i386/Reachability.o for architecture i386
Command
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang
failed with exit code 1
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
how could I get rid of this?
thnx!
I just deleted the Reachabilty Class Group from the Sharekit Group and added
#ifdef PHONEGAP_FRAMEWORK
#import <PhoneGap/Reachability.h>
#else
#import "Reachability.h"
#endif
to the SHK.m