Note that there are some explanatory texts on larger screens.

plurals
  1. POExpected ';' at end of declarations list
    primarykey
    data
    text
    <p>I'm trying to create a new Objective-C class in Xcode and am getting a couple of the above errors in the .m file.</p> <pre><code>#import "Query.h" @implementation Query { MPMediaQuery *query = [[MPMediaQuery alloc] init]; //create new query [[query addFilterPredicate: [MPMediaPropertyPredicate predicateWithValue: @"Vampire Weekend" forProperty: MPMediaItemPropertyArtist]]; //filter out artists except for Vampire Weekend // Sets the grouping type for the media query [query setGroupingType: MPMediaGroupingAlbum]; //sort by album NSArray *albums = [query collections]; for (MPMediaItemCollection *album in albums) { MPMediaItem *representativeItem = [album representativeItem]; NSString *artistName = [representativeItem valueForProperty: MPMediaItemPropertyArtist]; NSString *albumName = [representativeItem valueForProperty: MPMediaItemPropertyAlbumTitle]; NSLog (@"%@ by %@", albumName, artistName); NSArray *songs = [album items]; for (MPMediaItem *song in songs) { NSString *playCount = [song valueForProperty:MPMediaItemPropertyPlayCount]; NSString *lastPlayed = [song valueForProperty:MPMediaItemPropertyLastPlayedDate]; NSString *songTitle = [song valueForProperty: MPMediaItemPropertyTitle]; //NSString *info = [[NSString alloc] initWithFormat: @"%@ has been played %@ times.\n Last played %@.", songTitle, playCount, lastPlayed]; NSLog(@"\n%@ has been played %@ times.\n Last played %@.", songTitle, playCount, lastPlayed); } } // Override point for customization after application launch. [query release]; } @end </code></pre> <p>Xcode freaks out and gives errors at line that I define an object, or try to use query (since it is undefined).</p> <p>My header file is as follows (not complete, but I stopped to deal with this):</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; #import &lt;MediaPlayer/MediaPlayer.h&gt; @interface Query : NSObject { MPMediaQuery *query; } @property (nonatomic, retain) MPMediaQuery *query; @end </code></pre>
    singulars
    1. This table or related slice is empty.
    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