0

dyld: Library not loaded: @rpath/AFNetworking.framework/AFNetworking

Referenced from: /var/containers/Bundle/Application/

Reason: No suitable image found.

Sid Mhatre
  • 3,272
  • 1
  • 19
  • 38
shiv
  • 39
  • 8
  • 1
    Possible duplicate of [Reason: no suitable image found.](https://stackoverflow.com/questions/32730312/reason-no-suitable-image-found) – Adis Dec 22 '17 at 11:41
  • @Adis, It is a bit different than the one which you have given the link. – Kumar Reddy Dec 22 '17 at 11:52
  • It's a different framework, but the underlying error seems to be the same. I would suggest checking the possible solutions listed in that question. – Adis Dec 22 '17 at 15:44

3 Answers3

0

Explanation of the error:

Your app could not able to find the AFNetworking Dynamic Framework in @rPath. This is the place (rPath), where we should need to place our third party or our custom Dynamic Frameworks for the system to search for Dynamic Frameworks. So that system will search the rPath folder and will load them lazily instead of statically.

Solution:

If you are using Cocoapods, then cocoapods will itself do this step for you. Let me know if you are not using Cocoapods. If you still face the problem, just run Pod install once again..

enter image description here

if you are building your own libraries then you should place them in embedded binaries.

enter image description here

Kumar Reddy
  • 792
  • 6
  • 15
  • Thanks, I have use POD, pod install run many times but still facing. – shiv Dec 22 '17 at 12:17
  • did you check the Output files in Embed Pods Framework in Build Phases? Post the screenshot.? did you mentioned use_frameworks! in podfile ? check my first screenshot. – Kumar Reddy Dec 22 '17 at 12:19
  • did that work? Let me know if you face any issue. Post the screenshot for more info. If it resolved, please mark it as answer. – Kumar Reddy Dec 22 '17 at 12:36
  • "${SRCROOT}/Pods/Target Support Files/Pods-xxxx/Pods-xxxx-frameworks.sh" In Output file and Input file section nothing – shiv Dec 22 '17 at 12:37
  • That is input file. You should have output file. Please check my first screenshot. You can check CCXGoogleNearByPlaces.Framework...it is also just like AFNetWorking. – Kumar Reddy Dec 22 '17 at 12:38
  • Output file and Input noting "${SRCROOT}/Pods/Target Support Files/Pods-xxxx/Pods-xxxx-frameworks.sh" its in CP Embed Pods frameworks. – shiv Dec 22 '17 at 12:39
  • Input Files : ${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework . OutputFiles: ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework copy and paste the paths in input & output files. – Kumar Reddy Dec 22 '17 at 12:44
  • I have updated the screenshot. You can just replace the project name with your project name. It should work. – Kumar Reddy Dec 22 '17 at 12:47
  • Thanks, Still same problem, Now I have plan create other project(Clone). – shiv Dec 23 '17 at 04:19
  • Just remove the pod folder and pod.lock and then do pod install. Don't create new project. It will be the same thing – Kumar Reddy Dec 23 '17 at 04:25
  • Also try this "pod deintegrate" and manually remove pod.lock. – shiv Dec 23 '17 at 04:34
  • I will try "remove the pod folder and pod.lock and then do pod install". after I will update you today eve. Thanks for your response. :) – shiv Dec 23 '17 at 04:36
  • https://stackoverflow.com/questions/48081374/unable-to-run-application-on-device-dyld-library-not-loaded Please kumar check – shiv Jan 03 '18 at 16:49
0

It seems what you are using in AFNetworking is iOS11+, yet you've required it for your project, so when iOS10 searches its directories to find it, it finds nothing. The fact that the error says 'image' is just a fault on Apple's end.

Fix:

Under your project settings go to included frameworks, find AFNetworking and set the status flag from required to optional. Then, wherever you would use AFNetworking in your project, wrap it in the following:

if (@available(iOS 11.0, *)) {
    //your AFNetworking code here (for iOS11+)
} else {
    //comparable non-AFNetworking code here (for iOS10-)
}

Or just make your project require iOS11 under the deployment target flag.

Community
  • 1
  • 1
Albert Renshaw
  • 17,282
  • 18
  • 107
  • 195
0

I had the same issue, in my case the problem was that I had a certificate expired and marked as "always trust". I fixed it using the default setting for the certificates and deleting the expireds

andrehsouza
  • 479
  • 1
  • 5
  • 14