Note that there are some explanatory texts on larger screens.

plurals
  1. POIncompatible pointer type warning using NSOpenPanel
    primarykey
    data
    text
    <p>I had some code I used to open text files and it was working good, but now some parts of it are deprecated so I changed them to make it work without any error. I finished with a new code that it is working fine but it gives me a warning that I can not understand how to fix it... here is my code:</p> <pre><code>-(IBAction)openMyFile:(id)sender { int i; NSOpenPanel* openDlg = [NSOpenPanel openPanel]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSURL *myUrl = [NSURL fileURLWithPath:documentsDirectory]; //before here I had setDirectory but now is deprecated [openDlg setDirectoryURL:myUrl]; [openDlg setCanChooseFiles:YES]; [openDlg setCanChooseDirectories:YES]; if ( [openDlg runModal] == NSOKButton ) { NSArray* files = [openDlg URLs]; // here I had [openDlg filenames] but now is deprecated for( i = 0; i &lt; [files count]; i++ ) { NSString* fileName = [files objectAtIndex:i]; NSString *content = [NSString stringWithContentsOfURL:fileName encoding:NSUTF8StringEncoding error:nil]; //HERE IS WHERE I GET THE WARNING } } } </code></pre> <p>The warning I'm getting says: </p> <blockquote> <p>incompatible pointer types sending 'nsstring *__strong' to parameter of type 'nsurl *'</p> </blockquote> <p>and it comes out when I try to pass the content of the file in the NSString *content but anyway content is filled with the content of the file... everything seams to work good... Any help would be very much appreciated... Peace - Massy</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload