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"
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)
}
}
..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.
I have linker error:
Undefined symbols for architecture arm64:
_OBJC_CLASS_$_MTLRenderPipelineAttachmentDescriptorArray
with following code
var pipelineStateDescriptor = MTLRenderPipelineDescriptor()
pipelineStateDescriptor.label = "Test1"
pipelineStateDescriptor.sampleCount = 1
pipelineStateDescriptor.vertexFunction = vertexFunction
pipelineStateDescriptor.fragmentFunction = fragmentFunction
var colorDescriptor = MTLRenderPipelineAttachmentDescriptor()
colorDescriptor.pixelFormat = .FormatBGRA8Unorm
pipelineStateDescriptor.colorAttachments[0] = colorDescriptor
Is any solution for this?
Update:
This bug is no more actual in ios8 beta 3.
In your project build settings set "Optimization level" to "-Ofast", like this
Here is short info on compiler optimization flags
It seems to be a bug of beta sdk. I made a project in which I try to use Metal with Swift, go check it out https://github.com/haawa799/METAL_Playground.
Hope it will help.
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.