Crash on Device but not in Simulator when deleteRowsAtIndexPaths

Hi,
I'm getting this crash:
* Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit/UIKit-963.10/UITableView.m:729
2009-08-26 11:30:28.718 xxx[494:5917] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (7) must be equal to the number of rows contained in that section before the update (8), plus or minus the number of rows inserted or deleted from that section (0 inserted, 2 deleted).'
When calling this:
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath] withRowAnimation:UITableViewRowAnimationFade];
Not really sure what's going on. This works in the simulator no problem. I have no idea why it says 2 deleted since indexPath is declared like this:
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:(int)[sender tag] inSection:0];
So it can really only be one row that's being deleted.
Have any of you guys experienced this before? I'm lost on this one.
-Thanks

Hi Matt, and welcome to the Dev Forum!
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath]];
arrayWithObjects requires a nil terminated list. You could just strip the 's' off of Objects in this case, or add the terminator:
// this:
[NSArray arrayWithObject:indexPath]
// or this:
[NSArray arrayWithObjects:indexPath, nil]
When a required terminator is missing, the result is generally unpredictable. For example, your simulator binary might've wound up with 4 zero bytes after indexPath, while the device binary did not. This crash is an excellent example of how easily we can draw the wrong conclusion when comparing simulator and device runs. Note also, that if the code surrounding the above were changed in any way, you might be able to get the simulator to crash as well. Yet another way these machines know how to make people crazy.
Hope that helps!
- Ray

Similar Messages

  • Agentry App crashes on Device but not in the ATE Testenvirement

    Hello,
    we make a app which works fine in the ATE Testenvirement and also in a iPhone but our main Plattform is the The WIndows Mobile Pocket PC.
    We use a Motorola MC65 with Windows Mobile 6.1 Professional.
    On the Motorola the app crashes in a definite transaction when we close the transaction screen.
    Workflow is this: we open a detail screen with a listview -> with double click we pick a object from a collection and  starts the transaction -> close the transaction screen -> now a rule decide what will happen (you can see the rule in the picture) -> but the app crashs before something happens.
    Could we debug the client or could we create some loggings on the device? We dont know how we could find out why the app crashes. (as information: if the agentry client crashes on this point, we could not end the task from the agentry client with the task manager, we have to restart the Motorola client)
    Thanx,
    André
    Tags edited by: Michael Appleby

    Hallo,
    now we fixed the problem.
    As i told you we start the transaction screen from the detail screen and after ending the gtransaction the screen did not close and the client did not respond anymore.
    We fixed the Problem in this way that we do a navigationstep after the transaction step. In this we make the decision which screen should be shown as the next screen an open it. Thats all. In all other Client beside the WinCE Client the Transactionscreen closed and we could see the last detail screen. But on the  WinCE Client we nedd the navigation step.
    I dont know if this is a bug from the WinCE Agentry Client Version 6.1.4.54024 but this workarpund was the solution for us.
    @Jason: we breaking the rule down to separate subrules so the debugging in much better but we loose the reference to the object we used in the main rule, so we keep the active object refernce in a temp attribut at the main object and  get the active object with this id in the subrules

  • Tried syncing entire music library to ipod but some albums were skipped.  tried click and drag album but device does not get highlighted when i drag album there. any suggestions?

    I tried syncing entire music library to ipod.  some albums were skipped.  tried clicking and dragging but device does not get highlighted when i drag the album to the device. How can I sync album to ipod?  the album is imported and not purchased thru itunes store.

    Does it play in iTunes on the computer? What is the format of the album?
    Right click and select Get Info. Look under File in iTunes 12

  • My iPhone4 docks correctly with some devices but not others, please help!

    Hi,
    Firstly spologies if this is old news but sometimes its easier to 're-ask' than trawl thousands of pages!.....
    I have a 3-year old iPhone 4 that has developed a problem which i'm trying hard to solve;
    *Phone used to dock fine with anything and everything - this was about 1 year ago.
    *for no apparent reason it ceased docking with my Bose Soundock and a Logic3 accessory dock (connected to a hi-fi) at home
    *symptoms were; it would charge and operate as normal whilst docked but would not play music through either (the Logic3 dock did not acknowledge it was docked). Otherwise it would sync and connect normally with iTunes, etc. and connected fine when plugged into my car.
    *I reset it, restored it from back-up, updated/reinstalled iOS (this has since updated at least twice) with no other effects. Also checked and reset all settings.
    *I subsequently bought a Pure Contour dock as I was able to try it in the shop and my phone worked with it, plus it has Airplay anyway. I have since, in an attempt to find a bedside DAB radio/alarm dock that works with it, found that it works fine with some devices but not others with no rhyme or reason as to which.
    *2 days ago I changed out the docking port myself using a cheap replacement bought from Amazon, to see if it would cure.
    * now the problem is reversed! The Bose and Logic3 docks I have, that it wouldn't work on before, it now DOES....and the Pure dock and my car, which it DID work with before now fail to connect with it!
    *just to reiterate this, my wife's gen3 and gen5 iPods dock and work faultlessly with all devices mentioned....and mine had done previously.
    to my knowledge it is NOT;
    - a compatibility issue. The phone used to work fine on everything I had. Then it stopped. How's that?!
    - a connector issue. The male connectors on all docks haven't changed.......and the female connector in my phone has changed from liking selected devices to then liking the others!! (it is female after all ;-) !)
    -a software issue. iOS has been updated and the phone wiped and restored and all sorts so many times I can;t see how it can be!
    could it be a problem with the data exchange between phone and device when it is docked??
    or do I really need to try changing the port for an 'official' one??
    or is it just broken and that's that?!

    It's either a problem with the connector on your phone (dirt, lint, bent pin, corrosion) or with its connection to the motherboard inside. Cleaning the connector is a good place to start; either a dry toothbrush, air blast can or wood toothpick. Next inspect it carefully with a good magnifying glass or jeweler's loupe. If nothing turns up it is probably damage inside, which will be difficult to fix. Aren't you due for an upgrade about now? Your iPhone 4 is 3 generations out of date!

  • One device does not stop ringing when answering FaceTime with another

    Does anyone have this problem; I have a 15'' MBP 2011 OSX 10.8.2., and an iPhone 4 running iOS 6.0.1. When my FaceTime receives a call, both devices are ringing just as they should, but one device does not stop ringing when I use the other to answer the call. However, the call is disconnected after some time (like, if you don't answer at all, the call attempt is dropped). So, my FaceTime calls are constantly dropped. IF I answer and then choose to reject the call with the other device, the call is disconnected.
    This problem occurred some time ago, perhaps with the Mountain Lion upgrade, but not sure - I don't get that many FT-calls but from my family abroad.

    I had the same issue pairing a Mac G5 powerpc with a 2014 Macbook Pro and resolved it. In addition to pairing the devices through System Preferences>Bluetooth, make sure that "Bluetooth Sharing" is checked in System Preferences>Sharing as well. In my case, the devices always say "disconnected" in the Bluetooth panel, but change to "Connected" during an actual file transfer. Try sending a file even though it says "disconnected" and it may very well work fine. It also helps to check "Show Bluetooth in status in the menu bar" so you can quickly initiate a transfer from there.

  • When i connect my iphone 5 to my pc using the usb cable, my device is not recognized yet when connected to a power source, it charges normally. What should i do to rectify the problem and read sth about debris being in the usb. How do i remove that?

    When i connect my iphone 5 to my pc using the usb cable, my device is not recognized yet when connected to a power source, it charges normally. What should i do to rectify the problem and read sth about debris being in the usb. How do i remove that?

    iOS: Device not recognised in iTunes
    Windows: http://support.apple.com/kb/TS1538

  • How do I get the downloaded music on my iphone to my new home pc and itunes, it took the info from the 1st device but not the 2nd

    how do I get the downloaded music on my iphone to my new home pc and itunes, it took the info from the 1st device but not the 2nd

    the appletv will not display your movies in folders.
    you could change the tags in itunes to include the genre in the "show" field in the "video" tab. this would replicate the view you want, but you will need to tag all your movies to do this.

  • Graphics convert but not text even when ocr is disabled

    graphics convert but not text even when ocr is disabled

    Hmmm... I seem to have found the plist file that is doing it. I was looking at /Library/Application\ Support/Apple/Remote\ Desktop/ before... looks like /Library/Preferences/com.apple.ARDAgent.plist is the culprit.
    This plist is a binary, so I had to use plutil to convert to xml in order to make it human readable. I wonder if I can just hack this file up a bit and re-deploy it to each machine. Or I wonder if it would re-build if I simply remove it from each client. I will need to test to find out, seeing as though the task servers are listed in it, probably not a good idea to remove it all the way.

  • I have just signed upfor family sharing. Is there any way you can get the same app on two devices but not have to share it? My sons both want clash of clans but they don't want to be on the same village and they can't both be on app at the same time?

    I have just signed up for family sharing. Is there any way you can get the same app on two devices but not have to share it? My sons both want clash of clans but they don't want to be on the same village and they can't both be on app at the same time?

    hi, the app is not "shared", it works as if you bought the app twice with different accounts, only you paid it once. they should have 2 different villages since they're on 2 different devices.

  • Why do only some photos appear in iCloud folder on my PC and not all taken on iPhone appear on iPad either? All settings seem correct and new photos now seem to be appearing on all devices, but not all older or recent photos

    Why do only some photos appear in iCloud folder on my PC and not all taken on iPhone appear on iPad either? All settings seem correct and new photos now seem to be appearing on all devices, but not all older or recent photos, even if taken at same time. All advice greatly appreciated.

    First, to access documents you must use an app designed for that specific Document type. So Pages will not be able to open PDFs. The Documents app by Readdle can handle PDFs though. In the latter case, you'd open the app, click the menu icon at its top left, and click Open to go to your iCloud Drive. With Pages, if you had files outside the main Pages folder, click + then iCloud and navigate to the file's location.
    Matt

  • I want to buy poker chips from my iTunes account, but not do this when i want to buy that say"please contact iTunes support ti complete this transaction"for what is this i dunt understand this.plz solv this probleams.

    Hi,i'm Mizanur Rahman,i want to buy poker chips from my iTunes account, but not do this when i want to buy that say "please contact iTunes support ti complete this transaction" for what is this i dunt understand this.plz solv this probleams.but i parseas software from this account.so why not parseas poker chips? i have lote of blance in my account.so plz plz solve this provleams.
    <Personal Information Edited by Host>

    These are user-to-user forums, you are not talking to Apple here and they don't monitor these forums (I've asked the hosts to remove your email address from your post).
    You can contact iTunes support here and ask why you are getting the message and how to resolve it : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page

  • HT1725 Hi,i'm Mizanur Rahman,i want to buy poker chips from my iTunes account, but not do this when i want to buy that say "please contact iTunes support ti complete this transaction" for what is this i dunt understand this.plz solv this probleams

    Hi,i'm Mizanur Rahman,i want to buy poker chips from my iTunes account, but not do this when i want to buy that say "please contact iTunes support ti complete this transaction" for what is this i dunt understand this.plz solv this probleams.but i parseas software from this account.so why not parseas poker chips? i have lote of blance in my account.so plz plz solve this provleams.
    <Personal Information Edited by Host>
    iPhone 4, iOS 5.1.1

    You will need to do what it says, contact iTunes support. Click the Support tab above, then the Get Started link in the Contact Apple Support area and you'll be guided. We are all just fellow users here and so have no idea about the cause of the issue nor any ability to resolve it for you.
    Regards.

  • How can I share my music and some apps with my children's devices, but not share iMessage

    How can I share my music and some apps with my children's devices, but not share iMessage

    Then only set up your account in "Settings > iTunes & App Stores" and don't give them your password .

  • How do I remove a song that is on my device but not in my selected library?

    How do I remove a song that is on my device but not in my selected library?

    There is no way to delete songs from an iPod.
    Nothing will be touched on your iPod in regards to iTunes content with the first sync with iTunes on your new computer if you transfer your iTunes library from your old computer to your new computer following the simple instructions included with the link provided. Certainly as a Windows user you maintain a backup for all important data which should include your iTunes library? Important regardless the platform but even more so with Windows due to constant virus, adware, and spyware concerns. Or do most Windows users start with a new computer from scratch without transferring any data from an old computer to a new computer due to constant virus, adware, and spyware concerns?
    iTunes includes an option to transfer iTunes content that was purchased from the iTunes store only from an iPod - really. As the largest distributor for music and as #1 by far in MP3 player sales, this is required by those who own the distribution rights for the music. Part of an effort to prevent or minimize stealing music by those who own the distribution rights. 

  • HT1386 I am having trouble synching all 1700 songs that I just put into iTunes Music Match onto my iPod Classic device. It worked on my iTouch and iPad devices but not the Classic. How do I transfer the music successfully

    I am having trouble synching all 1700 songs that I just put into iTunes Music Match onto my iPod Classic device. It worked on my iTouch and iPad devices but not the Classic. How do I transfer the music successfully

    It should sync the same if the songs are the same. You can try:
    - Unsyncing all music and resysncing
    - Restoring the iPod
    BTW, yo posted in the iPod touch forum

Maybe you are looking for

  • Running a J2EE project on WAS at a regular interval

    I am going create a EJB project to poll (or check) any change in a DB and do some business logic or mapping everytime when the DB is changed. So, my question is how I can configure this project to run at a regular interval, says 5 mins? Since my WebS

  • How to Combine multiple files into the one file?

    Hi all, How do I combine multiple canon hf10 avchd files into the one file with a new extension. No need to be compressed. Afterwards, I also want to split this combined file to original files. Need Help!

  • Unable to resolve DB adapter runtime error for setMaxRaiseSize property

    I am writing files to DB in flowN activity using merge operation and getting merge operation failed error. Then I set the following 2 properties in .jca file: <property name="setMaxRaiseSize" value="100"/> <property name="setmaxTransactionSize" value

  • I can't drag and drop files to playlist or to Shuffle.

    I have iTunes 10.5, and I can't drag and drop files to playlists or to my shuffle.  For playlists, I have to right click and "add to playlist" and for shuffle, I have to copy song and paste it into shuffle.  Is anyone else having this problem? How ca

  • HT204409 I have a MacBook Pro and not able to connect to Internet? PLEASE help!

    I have a MacBook Pro and not able to connect to Internet.  I have other HP comp and iPad and am able to connect.  I have contacted AppleCare....they said disconnect router and leave unplugged for an hour, which I did...still no connection.  Any sugge