3

I'm very new to iOS and I'm coming from the Android background. I've read many post about this issue but I'm unable to resolve this issue.

My problem is that the app runs fine on the iPhone simulator but while running on the device it gives me following error -

error: 'AFNetworking.h' file not found

#import "AFNetworking.h"

        ^

<unknown>:0: error: failed to import bridging header ‘path/to/project/<main project directory>/projectName-Bridging-Header.h'

Update:

platform :ios, '7.0'
use_frameworks!

target 'SomeTarget' do

pod 'AFNetworking'
pod 'MSDynamicsDrawerViewController'
pod 'KRLCollectionViewGridLayout', '~> 0.2.0'
pod 'Canvas'
pod 'MBProgressHUD'
pod 'RBMenu'
pod 'RKTabView'
pod 'AHTabBarController'
pod 'Fabric'
pod 'Crashlytics'



end

My Bridging Header File

   #import "AFNetworking.h"
#import "UIKit+AFNetworking.h"
#import "MSDynamicsDrawerStyler.h"
#import "KRLCollectionViewGridLayout.h"
#import "Canvas.h"
#import "MBProgressHUD.h"
#import "UIScrollView+TwitterCover.h"
#import "A3ParallaxScrollView.h"
#import "ParallaxHeaderView.h"
#import "UIImage+ImageEffects.h"
#import "SGFocusImageFrame.h"
#import "RBMenu.h"
#import "ILBarButtonItem.h"
#import "CMPopTipView.h"
#import "RKTabView.h"
#import "AHTabBarController.h"
#import "UIViewController+MJPopupViewController.h"
#import "NSString+FontAwesome.h"
#import “KMAccordionTableViewController.h"
#import <Crashlytics/Crashlytics.h>

Can you please point the issue I'm getting right now. Why it is running fine on emulator and not on actual device?

Rahul Chaurasia
  • 1,601
  • 2
  • 18
  • 37
  • This is too little detail to help you with the problem. Are you using cocoapods or directly adding AFNetworking? What are your build settings? – lostInTransit Mar 18 '16 at 05:05
  • @lostInTransit, Yes I'm using cocoapods for adding the dependency. I've updated the question. Please check. – Rahul Chaurasia Mar 18 '16 at 05:14
  • @KiritModi Same error. My question if it is running fine on emulator, it shows that it is getting bridging header. Right? – Rahul Chaurasia Mar 18 '16 at 05:59
  • You are remove your old path ? - after again adding to drag Bridge file in it. after clean and RUN. – Kirit Modi Mar 18 '16 at 06:05
  • @KiritModi I did the same thing. Remove the older path, drag the file, clean and run. Still same error. And Yes, thanks for looking into the issue. – Rahul Chaurasia Mar 18 '16 at 06:16
  • Do your Header Search Path and Framework Search Paths for both configurations (debug and release) look the same? – lostInTransit Mar 18 '16 at 09:36
  • @lostInTransit These are not looking at the same location. My Framework Search Path contains entry for $inherited, $project_dir, $ dev_framework_dir and Header Search Path contains entries for $inherited, $pods_root/... ,$sdk_root – Rahul Chaurasia Mar 18 '16 at 11:38
  • The framework and header search paths will be different. But they should be the same for both release and debug configurations. Try adding the pods again, there doesn't seem to be anything apparently wrong (I suspect it is one of the build settings) – lostInTransit Mar 18 '16 at 11:45
  • @lostInTransit Yes both are same for debug and release configurations. Let me reinstall the pods again. Thanks much. – Rahul Chaurasia Mar 18 '16 at 11:58
  • @lostInTransit Reinstalling using pod deintegrate didn't help me :-( Can you please point me to the some tutorial/documentation/video where I can learn about this. – Rahul Chaurasia Mar 18 '16 at 13:51

1 Answers1

7

This might help somebody.

I've fixed this issue by adding an entry for Header Search Paths to "${PODS_ROOT}/" with recursive. Thanks to lostInTransit for pointing this attribute.

You can find Header Search Paths under BuildSettings for your project target.

Community
  • 1
  • 1
Rahul Chaurasia
  • 1,601
  • 2
  • 18
  • 37