-1

after adding -fno-objc-arc in afNetworking files i get these two errors

  1. synthesize of weak property is not allowed in arc in AFURLSessionManager.m file
  2. AFNetworking must be built with ARC in AFURLConnectionOperation.h file

anybody can help plz?

23-04-14 actually I dont have to add those linker flags.this was my problem APPLE MACH-O LINKED ERROR After adding AFNetworking I removed flags and added those libraries and problem solved. thanx everyone for help.

Community
  • 1
  • 1
Moaz Saeed
  • 1,006
  • 3
  • 10
  • 23
  • From what it sounds like, your AFNetworking class requires ARC, so disabling it is not allowed, and your AFURLSessionManager file has a synthesized weak property, so it cannot use ARC. I would recommend you use ARC whenever possible, so I would suggest that you remove the compiler flag and remove the synthesis of the weak property. – Liftoff Apr 22 '14 at 16:56
  • 2
    Why would you want to compile AFNetworking without ARC? The library was written using ARC. I don't think you have a choice in the matter here, unless you want to go in the code and manage the retain counts yourself. – Simon Germain Apr 22 '14 at 17:02
  • i i remove those flags i get mach-o- linker errors how can i remove them – Moaz Saeed Apr 22 '14 at 17:12
  • i followed this link http://code.tutsplus.com/tutorials/ios-sdk_afnetworking--mobile-10741 and it says add those flags.if i dont know what should i do to remove those 7 mach-o- linker flags. – Moaz Saeed Apr 22 '14 at 17:13

1 Answers1

0

You can fix this problem by changing those properties you have synthesized from weak to strong.

For Example if you have a weak property like this:

@property (weak, nonatomic) UIView *myView;

You have to change it like this:

@property (strong, nonatomic) UIView *myView;

But I am not a fan of Non-ARC projects I don't know much of releasing objects in NON-ARC projects, so check out any memory related issues by changing these properties to strong.

For more info check out this answer ARC Problems

Hope this post will help you

Community
  • 1
  • 1
E-Riddie
  • 14,660
  • 7
  • 52
  • 74
  • thanx erid for reply, I am using third party library AFNetworking and code is there.So, I dont want to change it .I think I dont have to add those flags as @Simon Germain said.I hope someone who used AFNetworking Library can solve my problem. – Moaz Saeed Apr 23 '14 at 07:11
  • 1
    Hmm, how did you import your AFNetworking to your project? If you are talking about this library https://github.com/AFNetworking/AFNetworking, it has no need adding -fno-obj-arc. When you install this project using Cocoa Pods, it creates a workspace, so you have to open .xcworkspace instead of . xcodeproj. Remove -fno-obj-arc and try installing AFNetworking from Cocoa Pods. open workspace #import and try running it – E-Riddie Apr 23 '14 at 09:13