Remove a ManagedObject from the table, but how do I remove the attached image?


Alex

I now need how to get the image reference from the managed object. This is the delete part when the user swipes and presses the delete key

            if editingStyle == .Delete {
            // Delete the row 
            //
            let managedObject: NSManagedObject = frc.objectAtIndexPath(indexPath) as! NSManagedObject
//context.deleteObject(managedObject)//outcommented to test
print("moc \(managedObject)")// i can see the right image file id/name but i don't now how to get it<-------
            removeImage("5354B06C-CFCB-4845-BEC3-B4B4855D8A36")//hardcoded to test if removeImage works and it does

            do {
                print("deleted")
                try context.save()
            } catch {
                print(error)
            }

        }

For my code to work, I just need to get the image name from the ManagedObject. When i print("moc(managedObject)") i see the image name

moc <Appointments: 0x1740c8f10> (entity: Appointments; id: 0xd0000000000c0000 <x-coredata://DE573499-064D-4840-819E-6ED2923E42CC/Appointments/p3> ; data: { appointmentImage = "C374341D-7256-4A67-B836-D82619A64AC8";
appointmentAmount = 258;

what should I do?

Vijay

Instead of casting the object to NSManagedObject, use the data model. If dating is your dating pattern, try this,

let managedObject = frc.objectAtIndexPath(indexPath) as! Appointments
removeImage(managedObject.appointmentImage)

Related


How can I remove the Altair yaxis of the attached image?

ZKK How to remove the blue part? import altair as alt from vega_datasets import data iris = data.iris() alt.Chart(iris).mark_point().encode( x='petalWidth', y='petalLength', color='species' ).configure_axis( grid=False ).configure_view( s

How can I remove the Altair yaxis of the attached image?

ZKK How to remove the blue part? import altair as alt from vega_datasets import data iris = data.iris() alt.Chart(iris).mark_point().encode( x='petalWidth', y='petalLength', color='species' ).configure_axis( grid=False ).configure_view( s

How can I remove the Altair yaxis of the attached image?

ZKK How to remove the blue part? import altair as alt from vega_datasets import data iris = data.iris() alt.Chart(iris).mark_point().encode( x='petalWidth', y='petalLength', color='species' ).configure_axis( grid=False ).configure_view( s

How can I remove the Altair yaxis of the attached image?

ZKK How to remove the blue part? import altair as alt from vega_datasets import data iris = data.iris() alt.Chart(iris).mark_point().encode( x='petalWidth', y='petalLength', color='species' ).configure_axis( grid=False ).configure_view( s

How can I remove the Altair yaxis of the attached image?

ZKK How to remove the blue part? import altair as alt from vega_datasets import data iris = data.iris() alt.Chart(iris).mark_point().encode( x='petalWidth', y='petalLength', color='species' ).configure_axis( grid=False ).configure_view( s

How can I remove the Altair yaxis of the attached image?

ZKK How to remove the blue part? import altair as alt from vega_datasets import data iris = data.iris() alt.Chart(iris).mark_point().encode( x='petalWidth', y='petalLength', color='species' ).configure_axis( grid=False ).configure_view( s

How can I remove the Altair yaxis of the attached image?

ZKK How to remove the blue part? import altair as alt from vega_datasets import data iris = data.iris() alt.Chart(iris).mark_point().encode( x='petalWidth', y='petalLength', color='species' ).configure_axis( grid=False ).configure_view( s

How can I remove the Altair yaxis of the attached image?

ZKK How to remove the blue part? import altair as alt from vega_datasets import data iris = data.iris() alt.Chart(iris).mark_point().encode( x='petalWidth', y='petalLength', color='species' ).configure_axis( grid=False ).configure_view( s

Remove attached image from jQuery dialog title

Jane S I've looked into various solutions on StackOverflow but haven't had any success getting them to work. I can easily add an image to the dialog, but various attempts to remove the image have failed, so I get multiple images. Note that I don't want it to a

Remove attached image from jQuery dialog title

Jane S I've looked into various solutions on StackOverflow but haven't had any success getting them to work. I can easily add an image to the dialog, but various attempts to remove the image have failed, so I get multiple images. Note that I don't want it to a

How do I remove the background from this kind of image?

hans-t I want to remove the background of this image to get the person only. I have thousand of images like this, basically, a person and a somewhat whitish background. What I have done is to use edge detector like canny edge detector or sobel filter (from ski

How do I remove the Indexes tab from a table in MySQL Workbench?

username How to drop an index from a table in MySQL Workbench? I'm pretty new to MySQL Workbench and not sure how to go about it. I've searched online but haven't found any useful information. For example; I've looked at the MySQL Workbench website, and the an

How do I remove the Indexes tab from a table in MySQL Workbench?

username How to drop an index from a table in MySQL Workbench? I'm pretty new to MySQL Workbench and not sure how to go about it. I've searched online but haven't found any useful information. For example; I've looked at the MySQL Workbench website, and the an

How do I remove the Indexes tab from a table in MySQL Workbench?

username How to drop an index from a table in MySQL Workbench? I'm pretty new to MySQL Workbench and not sure how to go about it. I've searched online but haven't found any useful information. For example; I've looked at the MySQL Workbench website, and the an

How can I remove this blank from the table?

Peter V I have a table that simplifies this problem while keeping it. It's a single row with three cells. The middle one contains the image, the first and last fill the remaining space, and should be blank textually. The height of the first and last cell match

Remove elements attached to image borders

Mostafa 2000 I'm using OpenCV to detect pneumonia in a chest x-ray using image processing, so I need to remove the additional area of the image border to get only the lungs, can anyone help me code in python? This picture explains the picture I want after appl

How do I completely remove colorama from this?

Milou I got this code from a friend, but since he's on linux he has colorama in it and it doesn't work for me, it's hard to read and/or copy and paste the results when the color codes are there. What do I need to edit to not include colorama? #!/usr/bin/python

How do I remove an interface from a bridge?

User 1595858 For some reason, we noticed that the two physical interfaces ( eth0, eth3) are under the same bridge vmeth0. We need to remove eth3from the vmeth0bridge without affecting the rest of the configuration. Please suggest any pointers to make this poss

How do I remove this fan from the heatsink?

João Pedro I don't know what this method of connecting the fan is called, so I have no way to look it up. I tried, but I don't know what to look for, so hopefully someone can tell me how to do it by looking at the pictures. Also, tell me what it's called so ma

How do I remove this fan from the heatsink?

João Pedro I don't know what this method of connecting the fan is called, so I have no way to look it up. I tried, but I don't know what to look for, so hopefully someone can tell me how to do it by looking at the pictures. Also, tell me what it's called so ma

How do I remove a user from the hub?

laboratory laboratory I post request via ajax to the method in the controller a string 'userName' which I should kick. Is it possible to remove the user who called the method in the controller from the current hub? public ActionResult Kick(string userName)