实现谓词但导致1 fetchedObject

时间:2017-02-06 12:56:24

标签: ios swift core-data nspredicate

在实施Predicate后,我在从CoreData获取结果时遇到了一些困难。实现只会产生1个fetchedObject,我不知道为什么。

Private Sub RR(PdfFileName As String)
    Dim reader As New PdfReader(PdfFileName)
    Dim RandomFileName As String = System.IO.Path.GetRandomFileName
    Dim OutputPdf As String = System.IO.Path.GetDirectoryName(PdfFileName) & "\" & System.IO.Path.GetFileNameWithoutExtension(RandomFileName) & ".pdf"

    Dim stamper As New PdfStamper(reader, New FileStream(OutputPdf, FileMode.Create))
    Dim table As New PdfPTable(1)
    Dim PageMargin As Single = 20
    Dim tbCell As New PdfPCell()

    table.TotalWidth = (reader.GetPageSize(1).Right - reader.GetPageSize(1).Left) - 20
    Dim PDfFormField As PdfFormField = CreateTextField(stamper.Writer, "TestField", 0, 0)
    tbCell = New PdfPCell With {.CellEvent = New iTextSharp.text.pdf.events.FieldPositioningEvents(stamper.Writer, PDfFormField), .MinimumHeight = 10, .BorderWidth = 0.1}

    With table
        .AddCell(tbCell)
    End With

    table.WriteSelectedRows(0, -1, PageMargin, Bottom + table.TotalHeight + PageMargin, stamper.GetOverContent(1))

    stamper.Close()
    reader.Close()

End Sub

Photo实体和Pin都有相互关系。

非常感谢此处的任何建议,谢谢!

1 个答案:

答案 0 :(得分:0)

Pins to Photos被认为是一对多的关系。当我设置模型时,我错过了这部分,将其设置为一对一的关系。在用新的模型版本修改它之后,它正常工作。