In the "mouseDown" (or MouseDreagged) code below Enclosure is a NSView subclass.
xcode report 2 warnings:
pb_item setDataProvider:self forTypes:[NSArray arrayWithObjects:NSPasteboardTypeTIFF, NSPasteboardTypePDF, @"LN_PboardType", nil]];
Sending 'Enclosure *' to parameter of incompatible type 'id _Nonnull'
NSDraggingSession *draggingSession = [self beginDraggingSessionWithItems:[NSArray arrayWithObject:drag_item] event:drag_event source:self];
Sending 'Enclosure *' to parameter of incompatible type 'id _Nonnull'
The application fail at:
drag_item = [[NSDraggingItem alloc] initWithPasteboardWriter:pb_item];
Pasteboard item data provider <Enclosure: 0x7f849ec74e70> must conform to NSPasteboardItemDataProviderProtocol
[General] There are 0 items on the pasteboard, but 1 drag images. There must be 1 draggingItem per pasteboardItem.
However if in the line of code above "pb_item" is replaced by "drag_image" drag work fine (but without drop).
The z_drag image follow the mouse correctly and "endedAtPoint" is called when the mouse button is released.
Where is the error ?
Any suggestion will be appreciate...
BigSur, xcode 12.4
- (void)mouseDown:(NSEvent *)drag_event /* or mouseDragged:(NSEvent *)drag_event */
{
NSImage *drag_image;
NSPoint drag_position;
NSDraggingItem *drag_item;
NSPasteboardItem *pb_item;
pb_item = [[NSPasteboardItem alloc] init];
[pb_item setDataProvider:self forTypes:[NSArray arrayWithObjects:NSPasteboardTypeTIFF, NSPasteboardTypePDF, @"LN_PboardType", nil]];
drag_image = [NSImage imageNamed:@"z_drag.jpg"];
drag_item = [[NSDraggingItem alloc] initWithPasteboardWriter:pb_item];
drag_position = [self convertPoint:[drag_event locationInWindow] fromView:nil];
drag_position.x -= [drag_image size].width/2;
drag_position.y -= [drag_image size].height/2;
[drag_item setDraggingFrame:NSMakeRect(drag_position.x, drag_position.y, drag_image.size.width, drag_image.size.height) contents:drag_image];
NSDraggingSession *draggingSession = [self beginDraggingSessionWithItems:[NSArray arrayWithObject:drag_item] event:drag_event source:self];
[draggingSession setAnimatesToStartingPositionsOnCancelOrFail:YES];
[draggingSession setDraggingFormation:NSDraggingFormationNone];
}
- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context
{
switch (context)
{
case NSDraggingContextWithinApplication:
return NSDragOperationCopy;
case NSDraggingContextOutsideApplication:
return NSDragOperationMove;
}
return NSDragOperationNone;
}
- (void)draggingSession:(NSDraggingSession *)session endedAtPoint:(NSPoint)screenPoint operation:(NSDragOperation)operation
{
NSPoint mouse_point;
mouse_point = [session draggingLocation];
switch (operation)
{
case NSDragOperationDelete:
break;
default:
break;
}
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
What is the Objective C equivalent of the command line
diskutil unmount force
?
DADiskCopyDescription() give basic information for disk and partition but not how these info elements are linked together.
By example how to get the volume parent container ?
How to decode de CFSTR given by DADiskCopyDescription() ?
When does DAMediaContent hold "GUID_partition_scheme" or "FDisk_partition_scheme" ?
For volume DAMediaContent is something like "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" (with volume name in DAMediaName).
But DAMediaContent with such numeric value is not always volume (DAMediaName and DAVolumeKind are then empty).
And sometime DAMediaContent is empty.
Where can I found documentation about DADiskCopyDescription() and the way to get APFS volume\container childs and parent
Not the graphic interface. Only an overview of the way to build the hierarchy (disk, container, partition) and functions call
When porting an old Mac project to Silicon (universal) I got an issue with IB to open MainMenu.xib:
Trust opening older file format?
“MainMenu.xib” uses an older format that is potentially insecure when decoded.
If you trust the content of this file, open and save it to upgrade to the modern format.
The "open and Upgrade" button make the MainMenu.xib not editable:
it seem that every submenus has disappeared.
How can I fix it ?
Any suggestion will be greatly appreciate.
Apple Transporter.app report this issue:
Asset validation failed (90237)
The product archive package's signature is invalid.
Ensure that it is signed with your "3rd Party Mac Developer Installer" certificate.
In the post "https://developer.apple.com/forums/thread/680438" Quinn “The Eskimo!” reply:
For the Mac App Store you need:
Apple Development: TTT (or the older Mac Developer: TTT) for day-to-day development
3rd Party Mac Developer Installer: TTT for signing the installer package you submit to App Store Connect
3rd Party Mac Developer Application: TTT for signing the code inside that installer package
In https://stackoverflow.com/questions/29039462/which-certificate-should-i-use-to-sign-my-mac-os-x-application"
Apple Codesigning Certificate Types
Mac App Distribution
3rd Party Mac Developer Application: Team Name Used to sign a Mac app before submitting it to the Mac App Store.
Mac Installer Distribution
3rd Party Mac Developer Installer: Team Name Used to sign and submit a Mac Installer Package, containing your signed app, to the Mac App Store.
Both Mac App Distribution and Mac App Distribution was added to Keychain Access:
Picture 1:
Xcode -> Preferences -> Account -> Manage Certificates show that "Mac Installer Distribution" is there:
Picture 2:
And "Mac Installer Distribution" is also shown in my "Account" -> Certificates, IDs & Profiles -> Certificates in developer.apple.com
Picture 3:
Is "3rd Party Mac Developer Installer" = "Mac Installer Distribution" missing somewhere ?
What can I do to fix "Asset validation failed (90237)" in Apple Transporter.app ?
Is CertificateSigningRequest.certSigningRequest needed by Transporter for a very plain Mac application like the default Xcode Application App (from new Project) ?
Is Apple ID and Developer Account independant ?
There is a problem with my Apple ID (Apple staff cannot resolve it).
What happen to my Developer Account if I delete (not reset) my Apple ID ?
In Xcode -> Product -> Archive
"ValidateApp" button tell: Your app successfully passed all validation checks
and "Distribute" button tell: App upload complete
After 5 working days App Store Connect -> Apps -> MyAppl always show "1.0 Prepare for Submission"
What can I do now ?
From Transporter I got this error:
App sandbox not enabled. The following executables must include the "com.apple.security.app-sandbox" entitlement with a Boolean value of true in the entitlements property list: [( "com.abirtz.lnc.pkg/Payload/lnc.app/Contents/MacOS/lnc" )] Refer to App Sandbox page at https://developer.apple.com/documentation/security/app_sandbox for more information on sandboxing your app.
The lnc.entitlements file is:
What is wrong ?
Thank you.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
App Store
Xcode
macOS
Entitlements
"https://appstoreconnect.apple.com/teams/047b121d-ab98-485e-858b-fa528d4af712/apps/6501988991/testflight/macos" -> "macOS Builds -> The following builds are available to test." show this message about Encryption: "Missing Compliance Manage".
My Mac OS application don't use any encryption.
From "Complying with Encryption Export Regulations" (https://developer.apple.com/documentation/security/complying-with-encryption-export-regulations):
"Add the ITSAppUsesNonExemptEncryption key to your app’s Info.plist file with a Boolean value that indicates whether your app uses encryption. Set the value to NO if your app—including any third-party libraries it links against—doesn’t use encryption"
But Info.plist no longer in Xcode (Version 15.4).
What can I do ?
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
Xcode
macOS
App Submission
in Apple documentation:
https://developer.apple.com/documentation/pdfkit/pdfannotationbuttonwidget/setbackgroundcolor(_:)?language=objc
What is the alternative (to set window background) ?
Topic:
Developer Tools & Services
SubTopic:
Xcode
Since dragImage: is deprecated I am trying to update drag and drop with beginDraggingSessionWithItems:.
Drag work fine but I cannot get drop to work correctly.
In the code below change #ifndef to #ifdef (using dragImage:) make drop work as expected.
draggingEntered, draggingUpdated, draggingExited, draggingEnded are all called but NOT performDragOperation (which do the drop).
Uncommenting the line
[pb_item pasteboard:paste_board provideDataForType:@"LN_PboardType"];
cause an exceptionPreprocess: -[NSPasteboardItem pasteboard:provideDataForType:]: unrecognized selector sent to instance 0x600001e64240.
I also try add NSDraggingDestination, NSItemProviderWriting, NSPasteboardTypeOwner to @interface line without success.
What I am doing wrong ?
Any other method to do Drag and Drop (other than dragImage: and beginDraggingSessionWithItems:) ?
Where can I found an Obj-C project using beginDraggingSessionWithItems: for drag an drop ?
``@interface Enclosure : NSView <NSDraggingSource, NSPasteboardItemDataProvider>
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
[super setAutoresizesSubviews:YES];
[self registerForDraggedTypes:[NSArray arrayWithObjects:@"LN_PboardType", NSPasteboardTypeString, nil]];
}
return self;
}
- (BOOL)acceptsFirstMouse:(NSEvent *)event
{
return YES;
}
- (void)mouseDown:(NSEvent *)drag_event
{
NSImage *drag_image;
NSPoint drag_position;
NSRect dragging_rect;
NSPasteboard *paste_board;
NSDraggingItem *drag_item;
NSArray *items_array;
NSPasteboardItem *pb_item;
paste_board = [NSPasteboard pasteboardWithName:@"LN_PboardType"];
[paste_board declareTypes:[NSArray arrayWithObjects:@"LN_PboardType", NSPasteboardTypeString, nil] owner:self];
pb_item = [[NSPasteboardItem alloc] init];
[pb_item setDataProvider:self forTypes:[NSArray arrayWithObjects:@"LN_PboardType", NSPasteboardTypeString, nil]];
// [pb_item pasteboard:paste_board provideDataForType:@"LN_PboardType"];
drag_image = [ [NSImage imageNamed:@"drag.jpg"];
drag_position = [self convertPoint:[drag_event locationInWindow] fromView:nil];
drag_position.x -= drag_image.size.width/2;
drag_position.y -= drag_image.size.height/2;
#ifndef DEPRECATED
[self dragImage:drag_image at:drag_position offset:NSZeroSize event:drag_event pasteboard:paste_board source:self slideBack:YES];
#else
drag_item = [[NSDraggingItem alloc] initWithPasteboardWriter:pb_item];
dragging_rect = NSMakeRect(drag_position.x, drag_position.y, drag_image.size.width, drag_image.size.height);
[drag_item setDraggingFrame:dragging_rect contents:drag_image];
items_array = [NSArray arrayWithObject:drag_item];
[self beginDraggingSessionWithItems:items_array event:drag_event source:(id)self];
#endif
}
- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context
{
if (disable_drag_and_drop)
return NSDragOperationNone;
switch (context)
{
case NSDraggingContextWithinApplication:
return NSDragOperationCopy;
case NSDraggingContextOutsideApplication:
return NSDragOperationMove;
}
return NSDragOperationNone;
}
…``
Topic:
Developer Tools & Services
SubTopic:
Xcode
When I have created my developer account I do it on a MacPro 2019.
Now I develop to a new silicon Mac. To submit the (Mac) application
App store Connect give a six-digit verification code.
This code must be enter to popup window that appear on Desktop.
But the popup window appear on MacPro 2019 instead of silicon Mac.
How can I receive popup window in the silicon Mac Desktop, not in MacPro 2019 ?
iCloud staff tell that it imposible to change the computer destination that receive popup window...
Is it true ?
Yes, I can use phone to enter the six-digit verification code but it is very more easy
to enter the code in the popup window.
In my developper account, "Certificates, Identifiers & Profiles" show
two "Developer ID Installer" certificates (Expiration Date 2027/05/13 and 2027/02/01)
I did not found any way to delete, remove or revoke one.
How can I fix it ?
Xcode complaint "Command CodeSign failed with a nonzero exit code"
Previouly I put right this error with the command:
xattr -cr path_to_application
but this no longer work.