I am new to iPhone app development so please be patient with me.
I have an UITableViewController which fetches an array of private messages threads using an API call.
I'm fetching the threads in viewDidLoad() and it has successfully stored into my class property of PMThreads. However the app just crashes silently after that without loading each thread into tableView.
This is the code I have: https://gist.github.com/884683
Please advise. Thanks in advance.
You should not release the data that you receive from the NSURLConnection request.
Try that!
/Kalle
So I've figured it out. It wasn't anything to do with ownership or retaining data.
I did my xib file improperly.
In my case, I put a UITableViewController, instead of a UITableView in the xib file. So in case anyone who share a similar experience, check your data ownership, as well as your xib file.
Run your app with Build and Debug. When the crash happens, open up the the debugger console (Cmd-Shift-R) and type bt. Copy the backtrace (everything after you typed 'bt') from the debugger console. Edit your message here and paste the backtrace.
As posted you're sending the release message to data and you don't even own the object. its currently in an autorelease pool. with no owner (ie. nothing has retained).
Read up on: http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html
your releases should be equal to your (retain/alloc/copy).
Related
I have an UploadCollection in my XML view bound to a JSONModel. When I add / delete files in the collection all works good initially. When I save the required data to the database and then refresh the JSONModel from the database I get the attached error. It is as if the elements are not being removed from the DOM, however, when I look at the entire process via the Chrome debgugger the elements are indeed gone in between. I am currently using OpenUI5 v1.78.1 but the same issue occurs with the latest (v1.86.3). The UploadCollection fails to work again from then on and I need to destroy it in my view before the data will be displayed again.
Has anyone seen this or have advice on how it may be corrected?
I figured it out. It appears that when I was calling UploadCollection.removeItem(item); it did not unregister the element somewhere and held onto the idea that the HTML elements still existed. Using item.destroy(); instead solved the issue.
In my app I have successfully started an instance of GCDWebUploader and I can upload files into my App's documents directory.
What I would like is to give the users the ability to stop the web sever whenever a button is pressed.
I've tried to set the instance to nil but this has no effect. Does there is a way to do this ? I've looked into the GCDWebUploader's header files but with no success !
Any help is greatly appreciated !
Have a nice day
GCDWebUploader subclasses GCDWebServer, so be sure to also look for methods in the super class. The one you would likely want is -stop.
I'm working on an iPad app in which I have a table view. When the user selects a row in the table, I use didSelectRowAtIndexPath to open a popover. I'm getting an error message saying "message sent to deallocated instance" when I try to use a certain button. I originally though the errors was getting thrown by the popover (in it's viewDidLoad or something), so I put a breakpoint in and stepped through the code. To my surprise, I was able to step all the way through the loading of the popover and the rest of the didSelectRowAtIndexPath on my table view (which actually just involves stepping out of some if blocks). The error then gets thrown when I get a couple steps into the automatically generated code that doesn't appear in any of my class files (that looks like 0x0010d71d <+1164> mov 0x6...).
So, my question is, how do I find where this error is being thrown? Is there another method that is automatically run after didSelectRowAtIndexPath that could be getting messed up somewhere?
Enable NSZombieEnabled in your DEBUG build (see How do I set up NSZombieEnabled in Xcode 4?) to locate instances of objects you're accessing that have been deallocated/released.
Also, consider upgrading your project to ARC, which will likely resolve memory management issues like this.
Okay, everyone's responses lead me to find malloc error -[CFString release], which helped me figure out I had a string in my popover that I alloc in viewDidLoad by
myString = [NSMutableString stringWithString:[myGlobalFunctionClass getMyString]];
Since I alloc it this way, it gets set to autorelease. The problem was I was explicitly [myString release]; and myString = nil; in viewWillAppear. Removing the release and =nil parts cleaned up my error.
To answer the actual question that I posted, I believe the autorelease wasn't firing until the simulator actually tried to display the popover (which would run after didSelectRowAtIndexPath). Since that occurs after I explicitly [myString release] in viewWillAppear, it was trying to autorelease something that was no longer there. Just to reiterate, the proper way to do it was let it autorelease at the end, and not [myString release] anywhere in my code.
Can someone verify that this is correct? As I mentioned in my comments, I'm still very new to iOS development. I have a feeling at the end of this project, I'm going to be able to go back to first stuff I did in it and make dozens of improvements in terms of doing things more efficiently and more in accordance with best practice.
I have an app with a tab bar controller which supervises two view controllers, each with it's own nib. Each nib has some external objects (the view controller in each case, plus some singletons in the other case). When this thing launches, I get messages in the console which say "missing proxy for identifier" followed by the name of one of the external objects. It looks to me like this is just a message as the app seems to run fine. The nib and objects all seem to be hooked up fine.
My question: is this message a problem, and if so, what is it trying to tell me? I feel like it may mean something is not hooked up correctly.
You are doing the following
you are using two rows in a table with same reusable identifier in a tableView or table view controller
Sometimes it might be due to some kind of conflict with a previous version if the app being installed, my problem was solved after deleting the app a reinstalling it.
What does the following error indicates
5/19/11 8:06:45 PM SpringBoard[9712] Error deserializing
wallpaper image: Error
Domain=CPBitmapErrorDomain Code=0 "The
operation couldn’t be completed.
(CPBitmapErrorDomain error 0 - No data
provided to
CPBitmapCreateImagesFromData)"
UserInfo=0x70b9c80 {NSDescription=No
data provided to
CPBitmapCreateImagesFromData}
Well, if you read the error message, it is telling you that a wallpaper was unable to be deserialised because no data was provided to the function named CPBitMapCreateImagesFromData. Pretty self explanitory.
Other than that, it sounds like you're either working on a jailbroken phone or trying to do things that aren't supported by the official iOS SDK - in which case my help ends here.
Or you're a user who is trying to understand why an image they set as a wallpaper isn't displaying and found their way to the iPad's console - in which case, this isn't the place to be asking.
This happened to me also, I think it's because most of the tutorials are written with an iphone in mind and I was using an iPad. I was working with an ipad and when following these tutorials i was getting this problem.
When you are creating the project I choose View based application. In the same wizard there's a combo box for 'iPhone' and 'iPad'.. If I leave that as iPhone then my application doesnt start in the simulator and I see the error you mention. If I set that to iPad then everything works fine.
I dont understand why that should make a difference tbh..
This happened to me, but only when I was not debugging, what happened was that in the dealloc function [super dealloc] was called at the top of the function rather than at the end. The "deserializing wallpaper" message is probably due to some sort of memory corruption that occurred since I had code after [super dealloc] trying to use pointers that were now garbage. I had NSZombie activated but it had no effect. Why this only crashed when I was not hooked up to the debugger is beyond me at the moment.
Thankfully this bug was fixed after a few diffs in source control, but initially I was pretty perplexed at the message and the fact that it was a bug where the debugger couldn't be used only induced more panic.
I'm sure you've long fixed your problem but I thought it'd be helpful to put this out there for others.