I currently have an app that loads an image from the web like this
[self.userImage setImageWithURL:IMAGEURL placeholderImage:[UIImage imageNamed:#"userPhoto.png"]];
and it works perfectly. I'm still wondering if I can somehow save or cache the image so it shows up quicker when the user opens the app again.
Any help is greatly appreciated.
EDIT:
After importing SDWebImage to my class and upon compiling I get this error
Ld "DerivedData/Social App/Build/Products/Debug-iphonesimulator/Social App.app/Social App" normal i386
cd "/Users/iamgretara/Documents/YouTube app "
setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk "-L/Users/iamgretara/Documents/YouTube app /DerivedData/Social App/Build/Products/Debug-iphonesimulator" "-L/Users/iamgretara/Documents/YouTube app /GDATA" "-F/Users/iamgretara/Documents/YouTube app /DerivedData/Social App/Build/Products/Debug-iphonesimulator" -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist "/Users/iamgretara/Documents/YouTube app /DerivedData/Social App/Build/Intermediates/Social App.build/Debug-iphonesimulator/Social App.build/Objects-normal/i386/Social App.LinkFileList" -Xlinker -objc_abi_version -Xlinker 2 -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=5.0 -framework ImageIO -framework MediaPlayer -framework CoreText -framework AVFoundation -framework SystemConfiguration -framework Security -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -o "/Users/iamgretara/Documents/YouTube app /DerivedData/Social App/Build/Products/Debug-iphonesimulator/Social App.app/Social App"
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MKAnnotationView", referenced from:
l_OBJC_$_CATEGORY_MKAnnotationView_$_WebCache in MKAnnotationView+WebCache.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Image of error
Sure, you can save the file to disk yourself and check if it exists before you try to load it (all based on URL matching). There are also libraries that will do this kind of stuff for you like SDWebImage / HJCache.
You can try AsyncImageView. It has inbuilt caching support.
try this:
you can try with EGOImageLoading
for image caching support.
Related
we have a legacy iOS objective C app. We want to add "swift" functionality. Created a separate "Cocoa touch framework" project to reference it from the "objective C" project. I am getting this error when I try to call/init any of the methods in swift from objective c
Ld /Users/teeboy/Library/Developer/Xcode/DerivedData/super-aybvkjtipygrszeyqsnbmtglaaqi/Build/Products/Debug-iphonesimulator/super.app/super normal x86_64
cd /Users/teeboy/iWorkbench/super
export IPHONEOS_DEPLOYMENT_TARGET=10.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -L/Users/teeboy/Library/Developer/Xcode/DerivedData/super-aybvkjtipygrszeyqsnbmtglaaqi/Build/Products/Debug-iphonesimulator -F/Users/teeboy/Library/Developer/Xcode/DerivedData/super-aybvkjtipygrszeyqsnbmtglaaqi/Build/Products/Debug-iphonesimulator -F/Users/teeboy/iWorkbench/super -filelist /Users/teeboy/Library/Developer/Xcode/DerivedData/super-aybvkjtipygrszeyqsnbmtglaaqi/Build/Intermediates/super.build/Debug-iphonesimulator/super.build/Objects-normal/x86_64/super.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -mios-simulator-version-min=10.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/teeboy/Library/Developer/Xcode/DerivedData/super-aybvkjtipygrszeyqsnbmtglaaqi/Build/Intermediates/super.build/Debug-iphonesimulator/super.build/Objects-normal/x86_64/super_lto.o -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -ObjC -all_load -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/teeboy/Library/Developer/Xcode/DerivedData/super-aybvkjtipygrszeyqsnbmtglaaqi/Build/Intermediates/super.build/Debug-iphonesimulator/super.build/super.app.xcent -lz -lPatientSearch -framework MapKit -framework ZipArchive -framework QuartzCore -lMobuleMenuCell -framework OCMockitoIOS -framework Security -lModuleNavigation -lToDoList -framework CoreData -lPatientChart -framework CoreText -framework Crashlytics -framework CoreLocation -lVisitNotes -lDataAccess -lDashboard -framework MobileCoreServices -framework SystemConfiguration -lframework -lsuperCommon -framework UIKit -framework OCHamcrestIOS -framework Foundation -framework CoreGraphics -Xlinker -dependency_info -Xlinker /Users/teeboy/Library/Developer/Xcode/DerivedData/super-aybvkjtipygrszeyqsnbmtglaaqi/Build/Intermediates/super.build/Debug-iphonesimulator/super.build/Objects-normal/x86_64/super_dependency_info.dat -o /Users/teeboy/Library/Developer/Xcode/DerivedData/super-aybvkjtipygrszeyqsnbmtglaaqi/Build/Products/Debug-iphonesimulator/super.app/super
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$__TtC5utils3zip", referenced from:
objc-class-ref in libDashboard.a(ASLandingPageVC.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The name of swift library is "utils". The legacy objective c app uses some other project dependencies. sorry, newbie to xcode.
Without knowing exactly how you referenced the Swift framework in the Objective-C app, I can only guess that you referenced a framework binary that is built for a platform different from the one you are trying to build the app for.
For instance, this would happen if you built the framework for a device, then included, in the Framework Search Paths under the app's Build Settings, the path to the directory containing the resulting .framework directory and then tried to build the app for a simulator. It would work if you used the correct framework binary (built for the simulator in this case).
However, a more elegant way of doing this is to embed the Swift framework in your application. Assuming the framework and the app are in different projects, you might do the following:
Ensure that the framework project is not open in Xcode.
Open the app project in Xcode.
Drag the framework's .xcodeproj from Finder to the app project in Xcode to create a reference.
Under General -> Embedded Binaries add your Swift .framework.
When you build the app, Xcode will build the framework for the correct architecture and use and embed it in your app.
See https://developer.apple.com/library/content/technotes/tn2435/_index.html for more info about embedding frameworks. BTW, when the linker failed, did you also see a warning from ld about a file missing a required architecture?
i am new to Xcode and obective-c and I have a problem with a project I have taken over from another developer on another machine. I cannot contact this programmer anymore (fired).
Ld /Users/*****/Library/Developer/Xcode/DerivedData/Dino-eyvcyvuofjuafncdadqeywyvdsra/Build/Products/Debug-iphonesimulator/Dino.app/Dino normal i386
cd /Users/******/Dropbox/Xcode/ABCiTY/Dino
setenv IPHONEOS_DEPLOYMENT_TARGET 5.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -L/Users/******/Library/Developer/Xcode/DerivedData/Dino-eyvcyvuofjuafncdadqeywyvdsra/Build/Products/Debug-iphonesimulator -F/Users/******/Library/Developer/Xcode/DerivedData/Dino-eyvcyvuofjuafncdadqeywyvdsra/Build/Products/Debug-iphonesimulator -filelist /Users/******/Library/Developer/Xcode/DerivedData/Dino-eyvcyvuofjuafncdadqeywyvdsra/Build/Intermediates/Dino.build/Debug-iphonesimulator/Dino.build/Objects-normal/i386/Dino.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=5.1 -lABCityCrossMarketing -framework AdSupport -framework CoreMotion -framework SystemConfiguration -framework CoreData -framework QuartzCore -framework CoreImage -framework AVFoundation -framework StoreKit -framework UIKit -framework Foundation -framework CoreGraphics -lGoogleAnalytics -lGoogleConversionTracking -o /Users/*******/Library/Developer/Xcode/DerivedData/Dino-eyvcyvuofjuafncdadqeywyvdsra/Build/Products/Debug-iphonesimulator/Dino.app/Dino
ld: library not found for -lABCityCrossMarketing
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can anyone help me with this?
You are missing the library file libABCityCrossMarketing.a.
A google for "ABCityCrossMarketing" returns nothing for me. Looks bad. If you still have access to his machine, then that looks like the only way to recover this file (it's possible this library was written by him and never published).
The message is clear here, I think:
library not found for -lABCityCrossMarketing
This happens when you move folders and the controls or basically any file is misplaced by Xcode and it doesn't know where to find it. You'd have to add it to your project again or change the path to it wherever it was listed.
I'm trying to impement SoundCLoudApi from here, but there is clang error without any description:
Ld /Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator/scapitest.app/scapitest normal i386
cd /Users/dimakorolcenko/Documents/SoundCloudIssues/scapitest
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator -F/Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator -filelist /Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Intermediates/scapitest.build/Debug-iphonesimulator/scapitest.build/Objects-normal/i386/scapitest.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -ObjC -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 /Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator/JSONKit/JSONKit /Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator/libJSONKit.a /Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator/libOAuth2Client.a /Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator/libOHAttributedLabel.a /Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator/libSoundCloudAPI.a /Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator/libSoundCloudUI.a /Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator/OAuth2Client/OAuth2Client /Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator/SoundCloudAPI/SoundCloudAPI /Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator/SoundCloudUI/SoundCloudUI -framework CoreText -framework CoreGraphics -framework Security -framework CoreLocation -framework AddressBook -framework AddressBookUI -framework QuartzCore -framework UIKit -framework Foundation -o /Users/dimakorolcenko/Library/Developer/Xcode/DerivedData/scapitest-dbwrumaigeiklgcvrmtokdvcppfu/Build/Products/Debug-iphonesimulator/scapitest.app/scapitest
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
I have completed all steps from instruction, but it doesn't work. I have no ideas, how to solve it. Please, help me to find solution. May be it is more common error, and it is not SoundCloud issue...
Your deployment target is probably wrong.
Select your project in the project navigator on the left side. Go to the build settings tab. Make sure your deployment target is iOS, not OS X.
I am trying to integrate Facebook into my app and have already implemented MGTwitterEngine with no issues. I keep getting an error now that I have tried to implement both Facebook sdk and MGTwitterEngine. I have read that there is a duplicate library between both SDK's and the individual said it had to do with the JSON Libraries. I deleted it from the Facebook sdk but I am still getting the error. Does anyone know what the issue may be?
So I understand it is referring to my armv6 in the error but there is no error at all until I try running Facebook sdk
Thanks
Ld "/Users/Alex/Library/Developer/Xcode/DerivedData/grocery-bhrkiajnjqfieahhdxilwtjggbqc/Build/Intermediates/grocery.build/Release-iphoneos/grocery.build/Objects-normal/armv6/grocery" normal armv6
cd /Users/Alex/Documents/Dictator/Lotto
setenv IPHONEOS_DEPLOYMENT_TARGET 3.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk -L/Users/Alex/Library/Developer/Xcode/DerivedData/grocery-bhrkiajnjqfieahhdxilwtjggbqc/Build/Products/Release-iphoneos "-L/Users/Alex/Documents/Dictator/Lotto/Classes/Twitter+OAuth 2/SAOAuthTwitterEngine" -F/Users/Alex/Library/Developer/Xcode/DerivedData/grocery-bhrkiajnjqfieahhdxilwtjggbqc/Build/Products/Release-iphoneos -filelist "/Users/Alex/Library/Developer/Xcode/DerivedData/grocery-bhrkiajnjqfieahhdxilwtjggbqc/Build/Intermediates/grocery.build/Release-iphoneos/grocery.build/Objects-normal/armv6/grocery.LinkFileList" -dead_strip -miphoneos-version-min=3.1 -framework Security -lxml2 -framework MessageUI -framework Foundation -framework UIKit -framework CoreGraphics -framework CoreData -framework MapKit -framework SystemConfiguration -lOAuth -o "/Users/Alex/Library/Developer/Xcode/DerivedData/grocery-bhrkiajnjqfieahhdxilwtjggbqc/Build/Intermediates/grocery.build/Release-iphoneos/Lotto Fetcher.build/Objects-normal/armv6/grocery"
ld: duplicate symbol _main in /Users/Alex/Library/Developer/Xcode/DerivedData/grocery-bhrkiajnjqfieahhdxilwtjggbqc/Build/Intermediates/grocery.build/Release-iphoneos/Lotto Fetcher.build/Objects-normal/armv6/main-280587BD193E8878.o and /Users/Alex/Library/Developer/Xcode/DerivedData/grocery-bhrkiajnjqfieahhdxilwtjggbqc/Build/Intermediates/grocery.build/Release-iphoneos/Lotto Fetcher.build/Objects-normal/armv6/main-B9843B6026D6EFA4.o for architecture armv6
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Duplicate symbol
Search your project for two copies of main.m file. :-)
after adding the OCMock framework i got that strange error... :(
ld: file not found: -fobjc-arc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It looks like if the compiler flag tries to be loaded by XCode?
Any idea?
Best regards, hijolan
I was getting the exact same error on Xcode 4.3.2. Here's my navigator log; I'm adding it for Google juice.
Ld /Users/makdad/Library/Developer/Xcode/DerivedData/Journal-bfkvfbsrkmrsjpddzfmwrstjfkzr/Build/Products/Debug-iphonesimulator/JournalTests.octest/JournalTests normal i386
cd /Users/makdad/Documents/MT/mt-mobile/iOS/Journal
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/phooze/Library/Developer/Xcode/DerivedData/Journal-bfkvfbsrkmrsjpddzfmwrstjfkzr/Build/Products/Debug-iphonesimulator -F/Users/phooze/Library/Developer/Xcode/DerivedData/Journal-bfkvfbsrkmrsjpddzfmwrstjfkzr/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/phooze/Library/Developer/Xcode/DerivedData/Journal-bfkvfbsrkmrsjpddzfmwrstjfkzr/Build/Intermediates/Journal.build/Debug-iphonesimulator/JournalTests.build/Objects-normal/i386/JournalTests.LinkFileList -mmacosx-version-min=10.6 -bundle_loader /Users/phooze/Library/Developer/Xcode/DerivedData/Journal-bfkvfbsrkmrsjpddzfmwrstjfkzr/Build/Products/Debug-iphonesimulator/Journal.app/Journal -Xlinker -objc_abi_version -Xlinker 2 -ObjC -force_load -fobjc-arc -ftest-coverage -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -lOCMock -framework Twitter -framework MapKit -framework MobileCoreServices -framework SystemConfiguration -lxml2 -licucore -framework CoreData -framework CoreGraphics -framework CFNetwork -framework QuartzCore -framework SenTestingKit -framework UIKit -framework Foundation -o /Users/phooze/Library/Developer/Xcode/DerivedData/Journal-bfkvfbsrkmrsjpddzfmwrstjfkzr/Build/Products/Debug-iphonesimulator/JournalTests.octest/JournalTests
The OCMock instructions explicitly ask you to add linker flags -- -ObjC and -force_load.
-force_load is expecting a value -- see the answer to this question that explains that -all_load is what to use if you don't want to specify a library name.
As someone who just spent 25 minutes on this, I should check again with the OCMock tutorial -- I don't think it was very clear in this instruction.
This blog post has a much better image that shows exactly how your settings should look.