|
carry on then posted:Thanks both for slogging through that wall of text, I really appreciate the help.
|
# ? Aug 8, 2011 07:34 |
|
|
# ? May 16, 2024 01:39 |
|
For whatever reason you're getting nil. Hell if I can see why, though. One question: why are you doing code:
code:
Also, you can store the delegate as the generic id type, which will allow it to take any object type as a delegate (not that it matters in this instance). You can check at runtime to see if the delegate responds to the necessary selector by doing code:
|
# ? Aug 8, 2011 08:16 |
|
Doc Block posted:The argument is that if some other thread tries to access the ivar after it's been released but before dealloc is finished, having it be nil'ed out will be "safe". But what if the other thread accesses your ivar after you've released it but *before* you set it to nil? Nilling out ivars will not help you with concurrency! Having said that, always nil (or reassign) your ivars immediately after releasing them, since you don't want any dangling pointers. Those errors are a bitch to find. I guess most of this won't be an issue any more in the near future, since ARC should take care of all that silly stuff.
|
# ? Aug 8, 2011 16:51 |
|
NoDamage posted:Yeah, that seems like the issue. Although based on your code I'm not completely sure why. Inside the showPreferences: method, it is getting a valid pointer to the App Delegate, it's just not passing it along or storing it correctly in PreferencesController. The ivar is given a property of assign which I think is the one to use, but could be the problem. Doc Bloc posted:One question: why are you doing This is another thing that's throwing me: self. The official documentation says it "returns the receiver," but that seems to be in the context of the method -(id)self. If self (the token) works like this in Java, how does preferencesWindow showWindow:self, which instructs preferencesWindow to show its own window, work? I don't understand what, exactly, is passed in when self is given as an argument.
|
# ? Aug 8, 2011 17:01 |
|
carry on then posted:Inside the showPreferences: method, it is getting a valid pointer to the App Delegate, it's just not passing it along or storing it correctly in PreferencesController. The ivar is given a property of assign which I think is the one to use, but could be the problem. Think of it as self being a pointer to the object asking, like "this" in Java. code:
|
# ? Aug 8, 2011 17:48 |
|
carry on then posted:This is another thing that's throwing me: self. The official documentation says it "returns the receiver," but that seems to be in the context of the method -(id)self. If self (the token) works like this in Java, how does preferencesWindow showWindow:self, which instructs preferencesWindow to show its own window, work? I don't understand what, exactly, is passed in when self is given as an argument. Think of self as local variable that's available in every Objective-C method and that refers to the object that performs the method. You can do whatever you want with it: message it, pass it as an argument to other methods and functions, even reassign it (like you do in -init methods). Now what's actually going on is this: every Objective-C method call is actually translated by the compiler into the C function objc_msgSend(id self, SEL cmd, ...) or one of its siblings. As you can see from that definition, self is actually a hidden parameter that's passed along with every method call. (The other hidden parameter, cmd, contains the selector (i.e. the name) of the method.)
|
# ? Aug 8, 2011 17:52 |
|
Thanks for the info on self. I suspected it worked like that, but the snippet I found when trying to open a window used self. That'll teach me to read the documentation. I removed the property on PreferencesController's delegate and implemented my own setter: code:
code:
More and more, this is starting to sound like one of those bugs that arises from fumbling around in the dark doing everything until it works. I think I'll take a step back and do some more reading while messing around with this some more. Thanks everyone for the extremely helpful responses.
|
# ? Aug 8, 2011 18:48 |
|
mc.schroeder posted:But what if the other thread accesses your ivar after you've released it but *before* you set it to nil? Nilling out ivars will not help you with concurrency! I hope I wasn't giving the impression that I thought it would. Dangling pointers can be a problem, though.
|
# ? Aug 8, 2011 20:43 |
|
Sir Davey posted:HOWEVER, I was not wrong to wonder wtf was happening when the object was being deallocated even though the retainCount was far greater than 1! No, don't look at retainCount at all, because it is useless for debugging memory management issues, and the documentation is explicit about this. An object could be retained by any number of frameworks without you knowing. Some Cocoa classes even return cached instances that never get released (e.g., NSNumbers representing integers between 1 and, I believe, 20). There are specialized tools for debugging memory leaks that you are supposed to use.
|
# ? Aug 9, 2011 21:03 |
|
I don't usually post to ask for help, but this has been a mystery to me for 4 days and I just can't wrap my head about what's happening. I probably hosed something up by trying to fix it already but here it goes: The setup: I have a Core Data sourced UITableView on my homescreen. Users can add items by clicking a lil' "+" button taking them through two views to enter data. The last view has a save button that saves the item into the managedobjectcontext and pops back to the root view controller. Last view also has a back button leading to the second view so the data there can be changed as well. The problem: The problem occurs when a user is not saving the object but pressing back until he's at the homescreen. In this case the tableview will show the unsaved object, and the app will (obviously) crash and burn when trying a delete on it. When I restart the app the object will be gone as it should, even though the crash happens right on saving the context (also wondering why it's not logged because I passed an NSError, but I guess it doesn't work exactly the same as try/catching) What I've tried so far: Changing around how the managedobjectcontext and fetchcontroller are instantiated in the root view controller, forcing a delete on back button press with unsaved objects, put [self.tableView reloadData] pretty much everywhere I could stick it, using copy instead of retain, and lots more desperate attempts that have probably hosed my code up beyond salvation. Some code I guess, you get to point and laugh. HomeScreenViewController.h (the root view controller) code:
code:
code:
code:
code:
code:
(i do realize all the setting to nil is probably useless) code:
code:
I'll be glad to post more code if you need it. e: also tried resetting and rollback'ing the context on viewwillappear for the root view newreply.php fucked around with this message at 22:02 on Aug 10, 2011 |
# ? Aug 10, 2011 21:39 |
|
newreply.php posted:backing out of core data managed object creation Fundamentally, what you're trying to do (I think) is: 1. Make a new instance of a managed object. 2. Let the user dick around with it. 3. If they hit 'save', keep it. If they back out entirely, lose it. The idiomatic way to do this is to instantiate a new managed object context, then insert your new managed object into this 'scratchpad' context. If you decide you want to keep the new object (user hits 'save'), merge the changes into your main managed object context. If you choose instead to forget about the new object, just reset the scratchpad context. There's a section of the Core Data Programming Guide that talks about this kind of thing, and check out the sample code project "CoreDataBooks" for an example of how to do exactly this.
|
# ? Aug 11, 2011 06:05 |
|
That's definitely the more flexible way of doing it... However why don't you just delete the object if the user doesn't hit save and the object is a new object? The problem is the insert happens in memory and nothing you are doing deletes that inserted object. I presume the save fails because the new blank object doesn't satisfy some CoreData constraints you have in your model. If you are trying to use the undo functionality, check out the CoreData guide and follow its directions to the letter or you will have endless trouble.
|
# ? Aug 11, 2011 17:53 |
|
Given a crash log and the .dSYM file associated with the release, what's the easiest way to symbolize the crash log? I'm using a script which uses xcrun to package my app so it's not in the Archived Applications section of Organizer. XCode 3.2.5 in case that matters.
|
# ? Aug 11, 2011 22:05 |
|
So I've made some progress on the issue I posted about earlier. To remind you guys, my problem is basically that I have a layer-backed view whose size changes periodically, and I'm having issues with the layer content getting stretched and distorted as the view's size changes. I've discovered the cause of the issue, but I can't figure out how to properly solve it. The size of the view is calculated and set in a relatively expensive layout method. Back before I started using layers, I would just call this layout method at the beginning of drawRect right before I started drawing, and everything worked fine. Now, since I'm using layers, I don't use drawRect anymore and instead use drawLayer:inContext:. It turns out that setting the view size within that method causes the stretching. For example, if the view gets taller in that method, the layer content will be drawn stretched out vertically. This happens even if I set the layer's frame to match the enclosing view's frame. The good news is that everything works fine if I instead calculate the layout at the same time that I call setNeedsDisplay on the content layer. The bad news is that within a single event loop I might be calling setNeedsDisplay on the layer several times depending on the event, and I have no way of reliably predicting whether any particular call is the last one of the event loop. Since my layout method is somewhat expensive, it's very wasteful to call it multiple times for a single redraw. So basically I need to somehow hook into the span of time between the final time I call setNeedsDisplay on a particular layer and the subsequent drawLayer method. Anyone have any ideas on how to do that? tl;dr: Is there any way to get a notification or callback or whatever when the event loop is finished, but before things are redrawn?
|
# ? Aug 12, 2011 08:22 |
|
Can't you just call setNeedsLayout? I would think that it just caches that and waits until the end of the loop to actually do the layout, but I'd have to test that to be 100% certain... It might happen immediately. You can schedule something to happen at the start of the next run loop iteration by using [[NSRunLoop currentRunLoop] performSelector:target:argument:order:modes], if a slight delay is acceptable.
|
# ? Aug 12, 2011 16:10 |
|
Actually, yes, that seems to work great! I had looked at setNeedsLayout, but I think I misinterpreted how it worked and I didn't think it was gonna work for me. Thank you for the suggestion, this problem has been bugging the crap out of me for a very long time!
|
# ? Aug 12, 2011 18:07 |
|
pokeyman posted:Fundamentally, what you're trying to do (I think) is: Thanks a bunch, pretty sure I'll get this working now. Would have been finished already if I did everything with NSUserPreferences but that wasn't an option due to sensitive information being stored, even if it is pretty simple data-graph-wise.
|
# ? Aug 12, 2011 18:25 |
|
newreply.php posted:It seems terribly convoluted when compared to Java/.NET ORM's though, first time I've encountered something that doesn't seem intuitive at all in CocoaTouch. For what it's worth, Ender.uNF's suggestion of just deleting the object should work too. My (thankfully limited) experience with NSFetchedResultsController has led me to believe that you're best off letting the managed object context and fetched results controller figure poo poo out themselves and to stay out of their way. (And this is why I've stopped using NSFetchedResultsController.)
|
# ? Aug 12, 2011 19:16 |
|
Hopefully i have an easy question. Not being a developer yet, i dont appear to be able to find an answer to my question anywhere else thus far. Is it possible to use a web link to open an app on the iphone/ipad. That is, either go to a website to open the app, and better yet, create a shortcut to it. If thstbis possible, can it be taken a step further and open an app in a specific state? For example, you click on an app link and the store opens on the right page. I'd like a certain file/whatever to open in an app. Short version - can i create hyperlinks that would open something like goodreader with a specific document opened within it? Thanks in advance.
|
# ? Aug 14, 2011 17:40 |
|
Mighty Zoltar posted:Hopefully i have an easy question. Not being a developer yet, i dont appear to be able to find an answer to my question anywhere else thus far. Yes, you can have your app launched with a custom url scheme (something like someApp://blah) and you can parse that URL to obtain information / do different things on launch based on it. Google 'iphone sdk custom url scheme' for lots and lots of info / examples, etc.
|
# ? Aug 14, 2011 18:10 |
|
Mighty Zoltar posted:Short version - can i create hyperlinks that would open something like goodreader with a specific document opened within it? What Lumpy said, though if you're trying to link to someone else's app, you're at their mercy. If they ever change their URL scheme, your links stop working. If you're talking about an app you control, then obviously you can handle that.
|
# ? Aug 14, 2011 18:21 |
|
Thats pretty much wha i wanted to hear, and it would be for my own app. Final question on this i think - could i have an app create a html link which looks how i want (small webpage image for example), which the app then saves to the app main ipad/iphone app screen, then open the right area of the app on open? Again using the goodreader example, i make a doc, ask for it to save as a quick link, where it drops a html link icon on the homescreen, shows a preview pic of the doc, and open the doc on a press?
|
# ? Aug 14, 2011 18:31 |
|
Mighty Zoltar posted:Thats pretty much wha i wanted to hear, and it would be for my own app. You'll need to do this through Safari, instructing the user to save a link to the home screen. You can set its icon there through a <link> tag. Unless you don't plan on distributing your app through the app store, in which case you can check out the UIWebClip class and the web clip methods on UIApplication.
|
# ? Aug 14, 2011 18:38 |
|
I can't figure this thing out about a table view cell's editing accessory view. I've made a little project to show off the issue I'm having. If you have a minute, could you run it in the simulator for me? Selecting a cell toggles its editing state if you want to play with it. In words, the problem I'm having is some weird animation in a UITableViewCell's editingAccessoryView on the first time the cell enters editing mode. I've found a workaround but I'd like to understand what's going on. If you run the app in the project, you'll see a table view. Edit it. Each cell has a round rect push button for an editingAccessoryView, which should slide in when entering edit mode. Watch the animation closely! The first time you hit the edit button, the rows without the workaround have the button's title slide in from the top, while the rows with the workaround slide in as expected. And it's only the first time entering edit mode; each subsequent time, you see the normal animation. Can anyone see why this is happening?
|
# ? Aug 15, 2011 04:54 |
|
pokeyman posted:I can't figure this thing out about a table view cell's editing accessory view. I've made a little project to show off the issue I'm having. If you have a minute, could you run it in the simulator for me? Selecting a cell toggles its editing state if you want to play with it. That's weird. I messed around with your sample code, and although I couldn't come up with why, I can reproduce the effect with this code. (just used in a View template project) code:
code:
|
# ? Aug 15, 2011 19:41 |
|
I cannot find any documentation about this behavior. I've added a UINavigationBar over a keyboard input, with two buttons that act as 'Tab' buttons to get to other textfields. The problem is: the keyboard autocorrects touches away from the buttons. If you type a number, then (relatively) quickly press the kNext button, it will press Delete instead. And there's another button (kPrev) that simply won't respond until a second or two pause has happened after pressing a key. HELP. I don't want to throw out this feature from the app, but as it stands it's unusable. Edit: at one point, I put HUGE buttons quite some distance from the keyboard. It still acted the same way. lord funk fucked around with this message at 01:24 on Aug 17, 2011 |
# ? Aug 17, 2011 01:21 |
|
Perhaps I suffer from mental retardation, because this should be a dead simple thing, but... How do you (or is there a way to) switch from a debug/development version of an app to the app store version without losing all the data in the app (by removing it outright)? I've been using one of my apps, and I don't want to have to deal with the expiring development provisioning certificates, but I don't want to lose my stored data either. I sent myself a coupon, so I do have the App Store version in iTunes. I figured it would overwrite the development version, but I suppose this was a silly thing to think since that would be a very, very annoying behaviour in many circumstances. Perhaps I'm not googling the right thing, but I can't find an answer. EDIT: I was fairly frightened that I had found a major bug that no one had reported, but no, it was just a lack of a provisioning profile. I suppose I feel slightly better now, but this is still an annoying problem. EDIT 2: I seem to have solved it by dragging the app from the Apps section to my iPhone in iTunes and re-syncing. Probably should have tried that first before freaking out... PT6A fucked around with this message at 03:43 on Aug 17, 2011 |
# ? Aug 17, 2011 02:30 |
|
lord funk posted:I cannot find any documentation about this behavior. I've added a UINavigationBar over a keyboard input, with two buttons that act as 'Tab' buttons to get to other textfields. Probably won't fix it but you should use a UIToolbar for this and not a UINavigationBar
|
# ? Aug 17, 2011 03:13 |
|
Why is it so hard to find some decent sample code that shows you how to build an app in Xcode 4 that uses a UITabBarController at its root, where one of the tabs gives you a UINavigationController that lets you drill down from a UITableView to a UIView? I mean, that's got to be one of the most common development scenarios, right? All I could find were a couple of videos, but one is from Xcode 3 and the other shows the guy dragging a nav controller into the tab bar's nib, then pointing it at a totally empty view. For example, when the nav controller is the root view, I know how to change the tab bar's color, but how would I change the color of the nav controller in that example? It kind of cuts off right before the most crucial step.
|
# ? Aug 17, 2011 05:32 |
|
Ok, I'm going nuts here. My goal is to programmatically create a DMG file, and my code looks like this:code:
code:
|
# ? Aug 17, 2011 05:37 |
|
Quotation marks are interpreted by the shell, not the kernel. You don't need them if you're splitting your command line up into separate arguments yourself.
|
# ? Aug 17, 2011 05:43 |
|
rjmccall posted:Quotation marks are interpreted by the shell, not the kernel. You don't need them if you're splitting your command line up into separate arguments yourself. Dagnabbit. I swear, I SWEAR, I tried that. Ah well, thanks, that did it.
|
# ? Aug 17, 2011 05:58 |
|
stray posted:Why is it so hard to find some decent sample code that shows you how to build an app in Xcode 4 that uses a UITabBarController at its root, where one of the tabs gives you a UINavigationController that lets you drill down from a UITableView to a UIView? I just did this on Monday. I am on my phone right now, but I will make a sample project and a quick step by step when I get home in 8 hours or so. I had some trouble at first, but I was making it far too hard, it turned out to be one of those "oh, duh!" things.
|
# ? Aug 17, 2011 11:45 |
|
Oh my god this is driving me crazy. I'm not new to iOS development, or even submitting apps, but I can't for the life of me get the Application Loader to accept my app! It says: Application failed codesign verification. The signature was invalid or it was not signed with an Apple submission certificate. But it was! I've selected the correct iPhone Distribution profile in the Code Signing Identity section of both my target and my project. I'm using a valid App Store distribution profile and submission certificate. The bundle identifier matches the profile (obviously, or I wouldn't be able to select it...) I don't know what the gently caress! I can sign development and adhoc distribution builds percectly fine, but no matter what I do the loader won't accept the App Store build. Are there any obscure things to look out for? Maybe some build settings? I've submitted tons of apps and if this has ever cropped up before it's been human error with selecting the wrong profiles and stuff.
|
# ? Aug 17, 2011 13:15 |
|
stray posted:Why is it so hard to find some decent sample code that shows you how to build an app in Xcode 4 that uses a UITabBarController at its root, where one of the tabs gives you a UINavigationController that lets you drill down from a UITableView to a UIView? Are you using Interface Builder for the interface or creating it programatically? In IB, if I've understood what you want correctly, you would do the following: First, switch the view mode to "As List". It will make everything much easier. In MainWindow.xib, select the Tab Bar Controller and open the attributes inspector. At the top, it should have a list of the tabs in the tab bar, followed by "View Controller" by default. Click on View Controller and a drop-down menu will open. Switch that to Navigation Controller instead. Now, find the navigation controller in the NIB hierarchy. Underneath the navigation controller there should be a view controller. This is your initial view controller. Use the inspector to switch its class identity to the desired viewcontroller class for the first view in that navigation hierarchy, and to switch it's NIB to the desired NIB. From here on, you can use that root view as you would the root view of any NavigationController, tab bar or not.
|
# ? Aug 17, 2011 15:04 |
|
Akuma posted:Application failed codesign verification. The signature was invalid or it was not signed with an Apple submission certificate. The last thing I check if this fails is my scheme. Are you 'Archiving' it? Edit your scheme and see what the build configuration is under the 'Archive' section on the left.
|
# ? Aug 17, 2011 17:00 |
|
Nope! Still don't know what's up but I remembered the last time I had to submit I ended up using another machine. Turns out it is signing it properly, because the other machine will submit it trough the application loader just fine. Mine just doesn't work for some reason.
|
# ? Aug 17, 2011 17:42 |
|
OHIO posted:I don't know if that's helpful. Something about the button title's frame not being created at first? Good catch. I think what's happening is the UIButton's titleLabel's frame isn't set until it's accessed, or until the button appears on screen. The title label is set as a subview of the button as soon as it's created, but its frame starts at zero. In other words, code:
I just assumed that whatever initialization that goes on here would occur on the first invocation of -setTitle:forState:. Thinking about it more, maybe it's done this way so the label can be given a size that fits the longest title set for the button? (Though isn't that what -sizeToFit is supposed to accomplish?) Anyway, I'm much happier with this getter workaround, so thanks for having a look.
|
# ? Aug 17, 2011 21:08 |
|
Why is my loving UITableView being retarded and not displaying the data? I have implemented UITableViewDataSource on my controller, so what the gently caress? ForumListViewController.m ForumListViewController.h
|
# ? Aug 18, 2011 17:27 |
|
|
# ? May 16, 2024 01:39 |
|
Probably because you haven't told your UITableView to use your controller as a data source.
|
# ? Aug 18, 2011 17:34 |