osx - How correctly drag and drop GIF from Safari to our app -


i need correctly parse gif file dropped safari. @ chrome or opera quite easy :

-(bool)performdragoperation:(id<nsdragginginfo>)sender {     if ([types containsobject:@"corepasteboardflavortype 0x75726c20"]) // gif format     {         nsdata* gifdata = [pb datafortype:@"corepasteboardflavortype 0x75726c20"];         nsstring* somename = [self _sanitizefilenamestring:[[nsurl urlfrompasteboard:pb] absolutestring]];         nsstring* tempstr = [[mssettingsmanager instance] tmpdir];         nsstring* randomfilepath = [nsstring stringwithformat:@"%@/%ld%ld%ld.gif",tempstr,random(),random(),random()];         if (somename)             randomfilepath = [nsstring stringwithformat:@"%@/%@ - %d.gif",tempstr,somename,rand()];         [gifdata writetofile:randomfilepath atomically:yes];     } } 

at safari, incoming types in pasteboard corrupts gif file.

nsfilespromisepboardtype - gives me nothing too.

if ([[pb types] containsobject:nsfilespromisepboardtype]){     nsurl* newfilepath = [nsurl fileurlwithpath:[nsstring stringwithformat:@"%@/",[[mssettingsmanager instance] tmpdir]]];     nsarray *filenames = [sender namesofpromisedfilesdroppedatdestination:newfilepath];     nslog(@"%@",filenames); // 0x000... } 

so, questing - how clear gif file pasteboard or row file without type.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -