从NSPredicate获得意外的表达错误

时间:2015-05-10 03:48:33

标签: ios swift nspredicate ckquery

我有以下代码:

"content IN %@ AND (tallied == 0)"

由于未捕获的异常'CKException'而抛出终止应用程序,原因:'意外的表达式:tallied == 0 OR comment!=“”'

但是当我尝试

"content IN %@ AND (comment != '')"

它工作正常,与

相同
 public MusicManager musicManager = MusicManager.getInstance(new MusicManager.MediaplayerUpdateInterface() {

    public void updateUI(int type) {
        updateMediaplayerViews(type);
    }
});

public void updateMediaplayerViews(int type) {
    switch(type) {
        case 0:
            this.runOnUiThread(new Runnable() {
                public void run() {
                    System.out.println("value? "+(musicManager.getCurrentTimeBAR()/musicManager.getSongLengthBAR()));
                    SongListFragment.musicManagerProgress.setProgress((int)((musicManager.getCurrentTimeBAR()/(double)musicManager.getSongLengthBAR())*100));
                    SongListFragment.musicManagerCurrent.setText(musicManager.getCurrentTime());
                    if(!SongListFragment.hasSetImage) {
                        SongListFragment.musicManagerTotal.setText(musicManager.getSongLength());
                        SongListFragment.musicManagerSongName.setText(musicManager.getCurrentSongInfo().getName().length() > 22 ? musicManager.getCurrentSongInfo().getName().substring(0, 19) + "..." : musicManager.getCurrentSongInfo().getName());
                        new DownloadListAdapter.DownloadImageTask(SongListFragment.musicManagerImageView).execute(musicManager.getCurrentSongInfo().getImgurl());
                        SongListFragment.hasSetImage = true;
                    }
                }
            });
            break;
        case 10:
            this.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Intent intent = new Intent(getBaseContext(), TrinityWidget.class);
                    intent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
                    int[] ids = {TrinityWidget.widgetId};
                    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,ids);
                    getBaseContext().sendBroadcast(intent);
                }
            });
            break;
    }
}

但我需要能够查询所有已记录的记录== 0或评论!=''。我该如何构建这个?