cocoa - Getting URL From beginSheetModalForWindow: -
I'm using OpenPanel to get a file path URL. It works:
[OpenLocalSteelSteelModelForvindo: The Windworkment Handler: ^ (NSINTER Return Code) {NSWRL * Pathtoophile = zero; If (returnCode == NSOKButton) pathToFile = [[Open URL] ObjectAntIndex: 0]; }];
It is not so, that resulted in the assignment of 'read-only variable':
NSURL * pathToFile = noil; [OPENEL start-startModelForvondo: Windows endowmentaler: ^ (NSiEater return code) {if (returncode == NSOK button) pathfile = [[Open URL] ObjectAntindex: 0]; }]; Return path tofile;
In general, any attempt to remove the path tofile from the context of Openech has failed. This is not such a big deal for small situations, but as my code grows, I am forced to give everything stuff - XML parsing, core data, etc. - inside an inappropriate area.
Thanks
Not only this, The variable 'to read is in the assignment error:
NSURL * pathToFile = zero; [OPENEL start-startModelForvondo: Windows endowmentaler: ^ (NSiEater return code) {if (returncode == NSOK button) pathfile = [[Open URL] ObjectAntindex: 0]; }]; Return path tofile;
Yes, because you are trying to allocate a copy of the variable pathToFile
that becomes the block when you create the block declared outside the block The original pathToFile
variable is not specified.
You can use the block to specify in this variable, but I do not think it will help because startSheetModalForWindow: completionHandler:
does not block (its in the documentation Not to mention, but there is no reason for the method of blocking, and you can verify with logging that it is not.) The message will arrive immediately, while the panel is still running.
Therefore, you are trying to allocate your full-operative block to a local variable, but your method in which you have declared a local variable, will likely come back by the blocks of that time, So it will not be able to work together in the block left variable.
Whatever you do with pathToFile
must be in the block itself or in the method (by calling a NSURL *
) by calling that block Could.
Comments
Post a Comment