Linking problem in Xcode when using a dependent subproject - iphone
I am using Xcode to write an iPhone project and I use an external library. I added the Xcode project file to the parent target and adjusted the header search path and set it as a direct dependency in the parent's build target.
Now the strange thing happens: I can open the library and compile it without problems. The library links to some frameworks e.g. AVFoundation.framework.
I clean the target and start building the parent project. In my build results I see that it builds the library, but then the linking fails with these error messages:
Undefined symbols:
"_AVCaptureSessionPresetMedium", referenced from:
_AVCaptureSessionPresetMedium$non_lazy_ptr in libZXingWidget.a(ZXingWidgetController.o)
(maybe you meant: _AVCaptureSessionPresetMedium$non_lazy_ptr)
"_CVPixelBufferGetHeight", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_CVPixelBufferLockBaseAddress", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_AudioServicesPlaySystemSound", referenced from:
-[ZXingWidgetController presentResultForString:] in libZXingWidget.a(ZXingWidgetController.o)
"_AudioServicesCreateSystemSoundID", referenced from:
-[ZXingWidgetController viewWillAppear:] in libZXingWidget.a(ZXingWidgetController.o)
"_CVPixelBufferUnlockBaseAddress", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_CVPixelBufferGetBaseAddress", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_CVPixelBufferGetBytesPerRow", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_iconv_close", referenced from:
zxing::qrcode::DecodedBitStreamParser::append(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned char const*, unsigned long, char const*)in libZXingWidget.a(DecodedBitStreamParser-64E27B33E79CBC52.o)
zxing::qrcode::DecodedBitStreamParser::append(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned char const*, unsigned long, char const*)in libZXingWidget.a(DecodedBitStreamParser-64E27B33E79CBC52.o)
"_OBJC_CLASS_$_AVCaptureVideoPreviewLayer", referenced from:
objc-class-ref-to-AVCaptureVideoPreviewLayer in libZXingWidget.a(ZXingWidgetController.o)
"_iconv", referenced from:
zxing::qrcode::DecodedBitStreamParser::append(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned char const*, unsigned long, char const*)in libZXingWidget.a(DecodedBitStreamParser-64E27B33E79CBC52.o)
"_OBJC_CLASS_$_AVCaptureSession", referenced from:
objc-class-ref-to-AVCaptureSession in libZXingWidget.a(ZXingWidgetController.o)
"_OBJC_CLASS_$_AVCaptureDevice", referenced from:
objc-class-ref-to-AVCaptureDevice in libZXingWidget.a(ZXingWidgetController.o)
"_kCVPixelBufferPixelFormatTypeKey", referenced from:
_kCVPixelBufferPixelFormatTypeKey$non_lazy_ptr in libZXingWidget.a(ZXingWidgetController.o)
(maybe you meant: _kCVPixelBufferPixelFormatTypeKey$non_lazy_ptr)
"_OBJC_CLASS_$_AVCaptureVideoDataOutput", referenced from:
objc-class-ref-to-AVCaptureVideoDataOutput in libZXingWidget.a(ZXingWidgetController.o)
"_CVPixelBufferGetWidth", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_AudioServicesDisposeSystemSoundID", referenced from:
-[ZXingWidgetController dealloc] in libZXingWidget.a(ZXingWidgetController.o)
"_OBJC_CLASS_$_AVCaptureDeviceInput", referenced from:
objc-class-ref-to-AVCaptureDeviceInput in libZXingWidget.a(ZXingWidgetController.o)
"_AVLayerVideoGravityResizeAspectFill", referenced from:
_AVLayerVideoGravityResizeAspectFill$non_lazy_ptr in libZXingWidget.a(ZXingWidgetController.o)
(maybe you meant: _AVLayerVideoGravityResizeAspectFill$non_lazy_ptr)
"_CMSampleBufferGetImageBuffer", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_iconv_open", referenced from:
zxing::qrcode::DecodedBitStreamParser::append(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned char const*, unsigned long, char const*)in libZXingWidget.a(DecodedBitStreamParser-64E27B33E79CBC52.o)
"_AVMediaTypeVideo", referenced from:
_AVMediaTypeVideo$non_lazy_ptr in libZXingWidget.a(ZXingWidgetController.o)
(maybe you meant: _AVMediaTypeVideo$non_lazy_ptr)
ld: symbol(s) not found
collect2: ld returned 1 exit status
I can include the needed frameworks in the parent project, but I thought that by including the frameworks in the library project the linking would be OK.
My question is: Do I have to include all the frameworks that my dependent subprojects use in the parent project to ensure proper linking, or am I doing something wrong?
Thanks for your help.
make sure include "CoreMedia.framework","AudioToolbox.framework","CoreGraphics.framework","CoreVideo.framework","AVFoundation.framework","libiconv.dylib"
frameworks in project in Build Phases
If the subproject compiles into a static lib, yes.
Related
realm swift: how could I trap on object being invalidated?
I'm attempting to add a watcher for isInvalidated on an object of interest like so: cancellable = images.publisher(for: \.isInvalidated, options: [.new]) .sink { newValue in print("property changed") } which yields Undefined symbols for architecture x86_64: "property descriptor for (extension in RealmSwift):__C.RealmSwiftEmbeddedObject.isInvalidated : Swift.Bool", referenced from: l_keypath in ContentCardView.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) at link time. How would I add a [programmatic] watchpoint for invalidation of an object in realm? PS a simpler way out via lldb does not work either (lldb) watch images.isInvalidated error: command 'watchpoint' did not recognize 'images .isInvalidated' as valid (subcommand might be invalid). (lldb) watch images.invalidated error: command 'watchpoint' did not recognize 'images .invalidated' as valid (subcommand might be invalid). (lldb) wa s v images.invalidated error: "invalidated" is not a member of "(Foo) images" (lldb) wa s v images.isInvalidated error: "isInvalidated" is not a member of "(Foo) images"
Accessing SBElementArray content from Scripting-Bridge in swift
I've been trying to use, in a swift code, the various SBElementArray generators defined in the iTunes.h ScriptingBridge header, for example: List of playlists: (SBElementArray<iTunesPlaylist *> *) playlists; List of artworks associated to a track: (SBElementArray<iTunesArtwork *> *) artworks; But when i try to use a method associated to the type contained in those array: let playlists: SBElementArray = iTunes.playlists() if let playlist = playlists[0] as? iTunesPlaylist { print(playlist.name) } I get a compile error: Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_iTunesPlaylist", referenced from: objc-class-ref in AppDelegate.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) This seems to be limited to the SBElementArray as I have no problem accessing current track name with the following : let track: iTunesTrack = iTunes.currentTrack; print(track.name) I'm also guessing that it has something to do with the type casting I'm trying to do from 'anyObject' to 'iTunesPlaylist' in my code (which i think i need to be bale to access the playlist content or whatever artwork i would like to display), because the following code: let playlists: SBElementArray = iTunes.playlists() print(playlists[0]) print(type(of: playlists[0])) corectly returns: <ITunesPlaylist #0x6080000402d0: ITunesPlaylist 0 of application "iTunes" (93931)> ITunesPlaylist
The downcasting is trying to create an optional and initialize an iTunesPlaylist that is not allowed and not present in the linker. Force it as you always know it to be a iTunesPlaylist or check the type. if playlists.count > 0 { let playlist : = playlists[0] if playlist is iTunesPlaylist { print(playlist.name) } }
PayPal sandbox error after logging in from another application
I have created a test website from where I'm redirecting to paypal sandbox account , to complete my transaction. Till some days it was working fine. But from today when I redirect to sandbox account, it gives me below error Error - If you were making a purchase or sending money, we recommend that you check both your PayPal account and your email for a transaction confirmation after 30 minutes. If you came to this page from another website, please return to that site (don't use your browser's Back button) and restart your activity. If you came from PayPal's website, click the PayPal logo in the upper-left corner to return to our home page and restart your activity. You might have to log in again. UserException: message 'An id of zero was passed to PartyPostalAddressPBImpl::load_by_id', return code: 3505 Backtrace: PPException::PPException(String const&) User::UserException::UserException(int, String const&) User::PartyPostalAddressPBImpl::load_by_id(unsigned long long) User::AddressPBImpl::load_by_id(unsigned long long, ForUpdate) User::ReputationALIImpl::processReputation(DeprecatedUserShim*, ReputationContainer*, char const*, int, MsgLog2*, DeprecatedUserShim const*) (anonymous namespace)::load_seller_details(PayPalCommonWebAppContext const&, PimpXClick&, unsigned long&, String&, ReputationContainer*) (anonymous namespace)::load_recipient_info(PayPalCommonWebAppContext const&, PimpXClick&, MerchantInfoUbiquityContainer&, CreditCardUbiquityContainer&, TransactionUbiquityContainer&, FlowInfoUbiquityContainer&, PassedParametersUbiquityContainer&, String&, ReputationContainer*, WalletInfoContainer*) Rapids::BusinessBlocks::HostedPayments::load_recipient(PayPalCommonWebAppContext const&, PimpXClick&, MerchantInfoUbiquityContainer&, CreditCardUbiquityContainer&, TransactionUbiquityContainer&, FlowInfoUbiquityContainer&, PassedParametersUbiquityContainer&, String&, WalletInfoContainer*) Rapids::Flows::OneX::StateOneXEC_Start::execute(Rapids::CGIVars const&) Rapids::DecoratedState::execute(Rapids::CGIVars const&) Riprap::RiprapRapidsGenericFlow::handle_execute(Riprap::WebAppContextOrnate const&, Rapids::TransitionRegistry const&, Rapids::State*, String const&, String const&, unsigned long long) Riprap::RiprapRapidsGenericFlow::process_states(Riprap::WebAppContextOrnate const&, Riprap::RiprapRapidsGenericFlow::ProcessStates, Riprap::DispatchInterceptorRegistry const&, Rapids::TransitionEdge const*) Riprap::RiprapRapidsGenericFlow::flow_call(Riprap::WebAppContextOrnate const&, Riprap::WebAppReturn const&, String const&, Riprap::DispatchInterceptorRegistry const&) Riprap::call_rapids(Riprap::WebAppContext const&, Riprap::RapidsFlowFactory const&, Riprap::DispatchAction const&, Riprap::WebAppReturn const&, String const&, Riprap::DispatchInterceptorRegistry const&) Riprap::dispatch_loop(Riprap::EPRegistry const&, Riprap::WebAppContext const&, Riprap::DispatchAction&, Riprap::WebAppReturn&, String const&, Riprap::DispatchInterceptorRegistry const&) Riprap::dispatch_wrapper(OutputStream&, Riprap::EPRegistry const&, Riprap::WebAppContext const&, Riprap::WebAppReturn const&, String const&, bool const&, Riprap::DispatchInterceptorRegistry const&) Riprap::entry_point(HTTPInterface&, Riprap::CGIVars&, OutputStream&, String const&, String const&) main Is there any issue with the merchant account to whom I pay? Or anything else. Please assist Thankyou
There is a problem with your test Business account. I'm also trying to figure out why it happens. If you want to continue testing, create a new business account in your sandbox. Dashboard > Sandbox > Accounts > Create Account
HTHorizontalSelectionList unexpectedly found nil while unwrapping an Optional value
..and I'll tell you why: I'm using the following pod: HTHorizontalSelectionList If I declare it like this: class RightViewController: UIViewController, HTHorizontalSelectionListDelegate, HTHorizontalSelectionListDataSource { var selectionList: HTHorizontalSelectionList! } I get the following error on compilation: ld: warning: directory not found for option '-FTest' Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_HTHorizontalSelectionList", referenced from: __TMaCSo25HTHorizontalSelectionList in RightViewController.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Huh!? What!? If I instead implement it like this it compiles fine! override func viewDidLoad() { super.viewDidLoad() var selectionList: HTHorizontalSelectionList! selectionList?.frame = CGRectMake(0, 0, self.view.frame.size.width, 40) selectionList?.delegate = self selectionList?.dataSource = self self.view.addSubview(selectionList) } ...except of course, I get an error on the addSubview line: fatal error: unexpectedly found nil while unwrapping an Optional value I'm finding it incredibly difficult to understand how Swift works when I get stuff like this happening quite often.
I'm finding it incredibly difficult to understand how Swift works when I get stuff like this happening quite often There is nothing difficult about this. You are starting out with your Optional variable set to nil. It stays nil. Eventually you try to unwrap nil and then you crash, because you can't do that: var selectionList: HTHorizontalSelectionList! // it is nil selectionList?.frame = CGRectMake(0, 0, self.view.frame.size.width, 40) // still nil, nothing happens selectionList?.delegate = self // still nil, nothing happens selectionList?.dataSource = self // still nil, nothing happens self.view.addSubview(selectionList) // unwrap, crash If you don't want to crash, assign selectionList an actual value other than nil, like maybe an actual HTHorizontalSelectionList.
iPhone - isKindOfClass generates a linker error
I have a class defined like this : #interface ServerCall : NSObject { // vars } // properties // functions (init) #end and #interface ServerNotification : ServerCall { // just vars } #end I have a call in another class : if ([call isKindOfClass:[ServerNotification class]]) // do things When building I have this error : Undefined symbols for architecture i386: "_OBJC_CLASS_$_ServerNotification", referenced from: objc-class-ref in ServerCommunication.o ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status "_OBJC_CLASS_$_ServerNotification", referenced from: objc-class-ref in ServerCommunication.o ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status I also have in build settings "Symbols hidden by default" = NO What did I miss ?
The linker doesn't find implementations for your ServerNotification class. Do you have the matching implementation file added to your target?