Post

Replies

Boosts

Views

Activity

Failure when setting file modificationDate
I properly copy a scrFile to a dstFile with mManager = [NSFileManager defaultManager]; [mManager copyItemAtPath:srcPath toPath:dstPath error:&error]; but on "some destination disks" the dstFile gets a modificationDate with truncated milliseconds. For instance, with this format "yyyy.MM.dd - HH:mm:ss:SSS" I visualize srcDate = 2024.11.03 - 12:42:35:772 dstDate = 2024.11.03 - 12:42:35:000 After the copyItemAtPath I even unsuccessfully tried to set the dstFile modificationDate this way NSMutableDictionary *dstAttrs = [NSMutableDictionary dictionaryWithDictionary:[mManager attributesOfItemAtPath:dstPath error:nil]]; [dstAttrs setObject:srcDate forKey:NSFileModificationDate]; [mManager setAttributes:dstAttrs ofItemAtPath:dstPath error:nil]; Again, the dstDate is 2024.11.03 - 12:42:35:000. I unsuccessfully tried even FSSetCatalogInfo(&dstRef, fsInfo, &srcFsCatInfo); No way. I noticed that the destination disk is an USB External Physical Volume, Mac OS Extended (Journaled) with "Ignore Ownership on this volume" on. Could this flag be the cause of the trouble? Shouldn't this flag regard only the files ownership? This issue brings another trouble. Since the srcDate and the dstDate are not equal, my macOS app performing a backup, copies the srcFile to the dstFile again and again. To workaround the trouble, I actually compare srcDate with dstDate after truncating their milliseconds. But I guess this is not a good practice. Any idea on how to fix this trouble? Thanks. P.S. I attach here the disk info Disk_Info.txt
2
0
258
3w
NetFSMountURLSync won't mount my FTP volume
I would like to replace the deprecated method FSMountServerVolumeSync with the newer one NetFSMountURLSync. I can properly mount my FTP volume using "Connect to Server" in the Finder and with FSMountServerVolumeSync (the volume comes as read only, but it's ok). When I try to mount the FTP volume with NetFSMountURLSync I get this error message: "The share does not exist on the server. Please check the share name and then try again". But as I know I can't define the share on a FTP server. How can I fix this issue?
2
0
235
Nov ’24
Change self.contentView.layer.maskedCorners in a chidWindow
I have added a NSWindow child to a main NSWindow to simulate a NSDrawer (since it has been deprecated). [mainWindow addChildWindow:drawer ordered:NSWindowBelow]; drawer.contentView.wantsLayer = YES; drawer.contentView.layer.backgroundColor = [NSColor clearColor].CGColor; drawer.contentView.layer.masksToBounds = YES; drawer.contentView.layer.cornerRadius = 10.0; Then I animate the drawer to the left/right to open/close it. It works well. Since I need only 2 rounded corners I have setup two conditions: when the drawer opens to the right side of the main window and when it opens to the left side. if(drawer.mSide == kSideRight){ drawer.contentView.layer.maskedCorners = kCALayerMaxXMinYCorner | kCALayerMaxXMaxYCorner;     } else{ drawer.contentView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMinXMaxYCorner;     } It works well at the first settings. If I later change side, as I change the maskedCorners as shown here above, I still see the drawer with the proper rounded corners but I also see an unwanted tiny dark "squared" border around the window, even close to the rounded corners. How can I update the layer to properly show the rounded corners without that squared border around the whole window?
2
0
1.5k
Mar ’21
NSMatrix within NSToolbarItem. Wrong space on Big Sur.
I have set up a NSToolbarItem containing a NSMatrix (2 buttons to toggle). On Catalina it looks well. On Big Sur, I get an unwanted space between the two (smaller) buttons. My settings: NSToolbarItem Size: Explicit Minimum Width 74 Minimum Height 37 Maximum Width 74 Maximum Height 37 NSMatrix Cell Size 37 x 37 Cell Spacing 0 x 0 Automatic Resizes Cells: YES Auto Recalculates Cell Size: NO Control Size: Regular View Frame: 74 x 37 Layout: Autoresizing Mask (All) The two icons size are 74 x 74 pixels. The toolbar height on Big Sur is smaller, so I end up with the single button size as 30 x 30 pixels and a matrix size as 60 x 30 plus an unwanted 14 pixels space between the two buttons. If I set the Minimum size to 60 x 30 pixels, it works well on Big Sur, but I get a smaller NSMatrix on Catalina. So, how to fix this trouble? At launch I get this Log message: NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints. But how to add constraints on IB to the NSToolbarItem only? The whole XIB file has no constraints.
1
0
982
Feb ’21
ScanAllPluginsInLibrary Log Message
Yesterday I abandoned Catalina and Xcode 12.3 and installed Big Sur 11.2 (20D64) and Xcode 12.4 on my MacBook Pro 16" top config. Now compiling my app is twice slower, when I select and work on a XIB file the fans begin to run fast and noisy and at any compile-launch I get 57 log messages like this ScanAllPluginsInLibrary: load Library [/System/Library/Filesystems/NetFSPlugins] The are many other smaller troubles but let's focus on these ones. What does it mean ScanAllPluginsInLibrary ? I have been searching on Google and found nothing explaining.
1
0
1.2k
Feb ’21
I set AVVideoCodecTypeAppleProRes4444 and I get a AVVideoCodecTypeH264 movie
I export a series of still images to a movie using AVFoundation. Despite I always set the codec to AVVideoCodecTypeAppleProRes4444, sometimes I get a movie with the AppleProRes4444 format, and sometimes, if I change the image sources, I get a movie with the H.264 format. I never change the codec, so I would like to know whether AVFoundation can autonomously change my codec. If no, as I presume, I would like to understand what I miss here. videoWriter = [[AVAssetWriter alloc] initWithURL:[NSURL fileURLWithPath:moviePath] fileType:AVFileTypeQuickTimeMovie error:&error]; NSParameterAssert(videoWriter); if(videoWriter == nil) return NO; NSString						*codec = AVVideoCodecTypeAppleProRes4444; NSMutableDictionary *videoSettings = [NSMutableDictionary dictionaryWithObjectsAndKeys: codec, AVVideoCodecKey, width, AVVideoWidthKey, height, AVVideoHeightKey, nil]; videoWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings]; NSParameterAssert(videoWriterInput); if(videoWriterInput == nil) return NO; NSDictionary *bufferSettings = [NSDictionary dictionaryWithObjectsAndKeys:NumI(kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange), kCVPixelBufferPixelFormatTypeKey, nil]; adaptor = [AVAssetWriterInputPixelBufferAdaptor assetWriterInputPixelBufferAdaptorWithAssetWriterInput:videoWriterInput sourcePixelBufferAttributes:bufferSettings]; if(adaptor == nil) return NO; NSParameterAssert([videoWriter canAddInput:videoWriterInput]); videoWriterInput.expectsMediaDataInRealTime = YES; [videoWriter addInput:videoWriterInput]; [videoWriter startWriting]; [videoWriter startSessionAtSourceTime:kCMTimeZero]; /* Then I add the images with */ [adaptor appendPixelBuffer:buffer withPresentationTime:CMTimeMake((int64_t)counter, (int32_t)fps)]; /* I previously created the buffer with */ CVPixelBufferCreate(kCFAllocatorDefault, width, height, kCVPixelFormatType_32BGRA, nil, &bufferRef); aRGBABuffer = CVPixelBufferGetBaseAddress(bufferRef); rowBytes = CVPixelBufferGetBytesPerRowOfPlane(bufferRef, 0); aRGBAContext = CGBitmapContextCreate(aRGBABuffer, iWidth, iHeight, 8, rowBytes, CGColorSpaceCreateDeviceRGB(), (CGBitmapInfo)kCGImageAlphaPremultipliedLast);
1
0
1.1k
Jan ’21
How to detect the backingScaleFactor on 4K LG monitor ?
I can quite move my macOS app's main window from my built-in Retina display to my external monitor (Samsung TV normal resolution) and everything works well because mScaleDisplay = [[NSScreen mainScreen] backingScaleFactor]; gives me the proper values: 2.0 on my Retina display and 1.0 on the Samsung TV. So I can properly set up the content of the window. Anyway it doesn't work on my customer's monitor 4K by LG (lg-27UD59-B) and macOS 10.14.1 Mojave. He sees a big image as it was a 1:1 resolution monitor. So I ask: how could I detect the resolution of this monitor?
1
0
1.1k
Jan ’21
Add a checksum file to my macOS notarised app bundle
I would like to detect whether my macOS app executable file has been altered by someone. I wouldn't rely on the Codesign because, as I have seen on the web, many apps have been cracked, even if notarised by Apple, even the Apple apps. I know my method will not guarantee the top security, but I would add this custom protection anyway. A) If I manually add a checksum file within the Resources folder in the bundle after the app has been Archived (so within the xcarchive package), it's too late. The app won't launch on macOS 10.15.6 because of the manipulation. I get a crash with "Termination Reason: Namespace CODESIGNING, Code 0x2". B) If I manually add or modify the checksum file after the app has been notarised, the same, it won't launch. C) If I modify the checksum resource file with a shell script during the build phase, before the "Run Copy Bundle Resources" phase, the checksum is wrong since the executable at that moment has a different file size and file modification date. D) Even the Terminal commands codesign --remove-signature Foo.app codesign -s "MyIdentity" Foo.app modify the executable file (file size and modification date, therefore even the checksum), so I can't use my checksum file created before the latest Terminal command… So, what's the best way to add my own checksum file to my app bundle? I run macOS 10.15.6 and XCode 11.5 and compile my 64 bits app for macOS 10.3/10.5.
6
0
1.7k
Aug ’20