IOS manually add third-party library error issues

Source: Internet
Author: User

When you do not want to use cocoapods to manage and use third-party libraries, you need to manually add and configure these third-party libraries, there will inevitably be some problems, the main issues are summarized as follows:

1, afnetworking, Nknetwork, ZXINGOBJC and other third-party libraries in order to support the lower version of the system (IOS 5,6) will appear cannot compile the following code

@property (nonatomic, Strong) dispatch_queue_t

This is because when the iOS SDK version >=6.0, ARC manages the GCD object, and when the iOS SDK version <6.0, GCD needs to be managed manually, and the following code is required for compatibility

//when declaring properties#ifOs_object_use_objc@property (Strong, nonatomic) dispatch_queue_t barrierqueue;#else@property (Assign, nonatomic) dispatch_queue_t barrierqueue;#endif//in the Dealloc method, you should add#if! Os_object_use_objc//This macro is only available after sdk6.0, and if it is before, then OS_OBJECT_USE_OBJC is 0dispatch_release (_barrierqueue);#endif//of course, you can also use#if__iphone_os_version_min_required < 60000//6.0sdk agodispatch_release (_barrierqueue);#endif//__iphone_os_version_min_required is the lowest deployment SDK version in engineering//OS_OBJECT_USE_OBJC This macro is only available after SDK6.0, if it is 6.0 before 0

If you deploy a minimum target lower than IOS 6.0 or Mac OS X 10.8
You should manage GCD objects yourself, using (dispatch_retain,dispatch_release), ARC does not manage them

If your minimum target for deployment is IOS 6.0 or Mac OS X 10.8 or higher
ARC has been able to manage the GCD object, when the GCD object is like a normal OC object, you should not use Dispatch_retain or dispatch_release

IOS manually add third-party library error issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.