|
Hog Obituary posted:Ah, thanks, so [self retain] or strongPointer=self is accepted practice for these kinds of things? Because that actually seems considerably more reasonable, but still weird. I've done it once or twice, and seen other people do it. Try to design your classes so you don't need to, but sometimes it can't be helped and is worth the extra safety. With [self retain] you just ido [self release] when you're done. Remembering should be easy enough since in this case it's going to be in the same method as the [self retain]. With ARC you assign self to a strong pointer and then use the strong pointer in place of self, to keep ARC from seeing that you don't use the strong pointer any further and immediately releasing it (and prevent it from being optimized out entirely). Doc Block fucked around with this message at 07:55 on May 19, 2012 |
# ? May 19, 2012 07:41 |
|
|
# ? May 16, 2024 15:54 |
|
Sorry I meant the short-lived object's -dealloc. Presumably it will be deallocated shortly after the delegate call that results in its no longer being held on to by its delegate.
|
# ? May 19, 2012 07:50 |
|
Yeah, he should be doing the cleanup in the short-lived object's -dealloc, but sometimes you can't avoid doing it this way.
|
# ? May 19, 2012 08:00 |
|
Usually the best pattern is for there to be a very clear hierarchy of ownership and a very clear stage of teardown that originates from the owner. Even putting memory safety aside, if an event is propagating up from a child, the parent immediately tearing things down is going to leave that portion of the tree in an inconsistent state when control returns to the child. Instead the parent should say "hmm, come back to me after this operation is done and I'll tear all this down", e.g. by dispatching a block to do that on the current queue.
|
# ? May 19, 2012 08:37 |
|
What is the simplest way for a non-US resident to sell apps in the US app store? Can a foreigner of any country register without a problem, or are onpy certain countries allowed? Would I have to pay US income tax?
|
# ? May 19, 2012 11:57 |
|
As far as I know, anyone from just about any country can sell apps in the US app store. I've got a few apps that were developed by people/studios from other countries. If the US has a tax treaty with your country, you can just pay income tax in your home country. You may need to file paperwork to make that official. Aside from sales tax (which Apple will add on and collect for you) Apple doesn't withhold any money for taxes.
|
# ? May 19, 2012 16:26 |
|
So I'm curious: how's everyone liking storyboards? I've only used them on a couple apps and I find two things: I'm writing more code than I was without storyboards; and after about the fourth view controller on the storyboard I start to get lost and frustrated zooming the editor in and out. Storyboards feel promising but they don't yet offer me much. Maybe I'm missing some compelling feature?
|
# ? May 20, 2012 09:09 |
|
Is there some secret functionality attached to the keystroke ctrl-T that I'm not aware of? I'm trying to catch a string of characters with ctrl held down but holding control and pressing T does not deliver a key event to my window. This is the only key I've tried so far of which that's true. What does pressing ctrl-T do, and is there a way to bypass it so I can run my own code in response?
|
# ? May 20, 2012 23:46 |
|
Testing syntax highlighting.Objective-C code:
|
# ? May 21, 2012 11:47 |
|
Doc Block posted:If memory serves, ARC is only supported on iOS 4.3 and up, not 4.2. Yes, I'm only changing the sprite's transparency. The overly sprite is a tiny sprite that get's scaled to the screens size so a half-transparent texture is put over everything except for a few buttons so everything else appears darker. Doc Block posted:If memory serves, you're using a really old version of Cocos2D, right? Which means you probably started from the really old Cocos2D project template, right? Maybe the old template didn't have any of the multitasking methods in the app delegate. All I'm doing differently is changing the pixel format to kEAGLColorFormatRGBA8. When I change it back to kEAGLColorFormatRGB565, the problem no longer occurs. Doc Block posted:This is because RGBA8 means your OpenGL ES framebuffer is 32-bit RGBA, meaning it supports the framebuffer itself being transparent. You'll note that the RGB565 pixel format has no mention of an alpha channel, hence you cannot get a transparent framebuffer when the pixel format is RGB565. What I'm trying to show through is showing through fine. It sounds strange, but it's my own custom parallax background class made outside of Cococs2D. The reason I felt like I needed this is because I wanted preserve the parallax while Cocos2D does scene transitions which slides the last scene off the screen while a new one is dragged on. Using the Cocos2D parallax background I couldn't achieve this correctly because the new parallax background would be overlapping the old one. I tried syncing them, but it just became a mess. Performance is great with my new parallax class, and the frame rate in Cocos2D isn't hindered at all. I also have my own gradient background behind that which I can do a lot more with than the Cocos2D. But anyway, still having problems. By the way, I'm using Cocos2D 0.99.5.
|
# ? May 21, 2012 14:07 |
|
Question about feasibility here... I'm a mentor for a high school FIRST Robotics team. We go to competitions to go against other robots like ours. Scouting out what other robots can do is an important part of strategy, and I'd like to use iPads to accomplish this. There are usually (depending on the year) 6 robots competing against each other every match, so I'd like to use 1 iPad per robot and a host laptop for them all to connect to. Unfortunately, the robots are connected wirelessly to the drivers via wifi, and because the organizers want to minimize interference, they have banned all 802.11 communication (i.e., no wifi). However, buying 6 iPads with 3G/4G connectivity is pretty darned expensive especially with data plans. I'm really looking for a way to get the iPads to talk to the computer via bluetooth or USB if possible. I'm pretty sure I'd be able to get the iPads to talk to each other with the Game Kit and bluetooth, but is there any way I could trick a laptop to "think" it's an iOS device to make it connect via bluetooth? Or am I stuck buying a 7th iPad to act as the host?
|
# ? May 21, 2012 22:48 |
|
Someone on the Cocos2D forum answered back with a suggestion that worked for the same "slow down" problem that worked for Cocos3D. In applicationDidBecomeActive, instead of calling resume on the director like [[CCDirector sharedDirector] resume];, call it like this with a selector: [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(resumeGame:) userInfo:nil repeats:NO]; and make my own method that calls it in director: -(void) resumeGame:(NSTimer *) sender { [[CCDirector sharedDirector] resume]; } Not sure why that fixes the bug, but it does. I'm still having the transparency problem if anyone knows what could be up. I'm now suspecting it could have to do with setting CCTexture2D's DefaultAlphaPixelFormat like [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888]; ? Is it the wrong setting for Cocos2D having a transparent background? See my previous post for details.
|
# ? May 22, 2012 19:58 |
|
A couple weeks ago I built a game with cocos2d and I loved it. My first exposure to Obj C and Xcode too. All good things. Only thing that kinda sucks is all the code examples out there talk about cocos 1.x, not the 2.0 I've been using. I've eventually figured out how to do everything I've needed though, so I guess that isn't actually a problem.
|
# ? May 22, 2012 20:46 |
|
LP0 ON FIRE posted:I'm still having the transparency problem if anyone knows what could be up. I'm now suspecting it could have to do with setting CCTexture2D's DefaultAlphaPixelFormat like [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888]; ? Is it the wrong setting for Cocos2D having a transparent background? See my previous post for details. RGBA8888 means you're getting 32-bit textures with full alpha transparency support. This is what you want if you are looking for textures that have smooth gradients and smooth alpha transparency instead of just on/off transparency. It takes up the most memory, though. It could be a bug in Cocos2D, it could be a bug in iOS, or it could just be weirdness resulting from the combination of the specific blending modes Cocos2D is using, your framebuffer's pixel format, and having UIKit stuff underneath. Newer versions of Cocos2D get along better with UIKit. Doc Block fucked around with this message at 02:54 on May 23, 2012 |
# ? May 23, 2012 02:50 |
|
Carthag posted:I get an exception in my code: You didn't somehow let it garbage collect it or something thats nulled it out? Though gently caress knows why the key would be missing. Weird rear end thing.
|
# ? May 23, 2012 16:57 |
|
I wrapped both read & write access to the dictionary in @synchronized() blocks and that seemed to take care of it (I was accessing the dictionary in some concurrent array & set enumerations, so presumably that was the cause. The mutable containers aren't threadsafe). It's been refactored away now though. Under ARC, too, so no garbage collection.
|
# ? May 23, 2012 18:16 |
|
Carthag posted:I wrapped both read & write access to the dictionary in @synchronized() blocks and that seemed to take care of it (I was accessing the dictionary in some concurrent array & set enumerations, so presumably that was the cause. The mutable containers aren't threadsafe). It's been refactored away now though. Concurrency is dark magic voodoo sometimes. Sounds like plain old memory corruption. Glad you solved it.
|
# ? May 23, 2012 18:37 |
|
I am trying to put a Movie player on the screen centered horizontally (equal space left and right), that *stays* centered when I rotate the device. My thought process is: figure out where to put movie view, put it there, set auto-resizing masks to flexible left and right margins. Objective-C code:
Should I give up and just move the view manually in a rotation handler, or am I doing something stupid?
|
# ? May 25, 2012 20:49 |
|
btw can we put either of these on every page?Ender.uNF posted:Threads: The Great Heisenbug Simulator. duck monster posted:Concurrency is dark magic voodoo sometimes. Sounds like plain old memory corruption. Glad you solved it.
|
# ? May 26, 2012 05:11 |
|
Is there a way to customize the appearance of an NSPopover? The popover's view doesn't reach all the way to the edges: I'm trying to achieve an effect similar to the popovers in the GitHub app, with content extending all the way to the edges: I suspect the answer is going to involve implementing an entire custom popover class from scratch, but maybe there's a way to just override the drawing of the standard popover.
|
# ? May 27, 2012 19:06 |
|
e: scratch that, macos not ios. Can you just do a plain old view and set it transparent or something? I havent really poked around the macos sdk yet.
|
# ? May 28, 2012 14:58 |
|
Well I can't use just a view because I need it to function like a popover and be overlaid on top of other views. I would need to somehow override the drawing of the popover itself or draw outside of the bounds of the popover's view (NSBezierPath's setClip didn't work).
|
# ? May 28, 2012 18:50 |
|
GitHub for Mac uses Chameleon, so if you go the custom route, you can check out their implementation. I doubt it'll be worth outright lifting their classes but it might give you a head start. If I was reimplementing it, I'd use an attached NSWindow. It's mostly boilerplate from there.
|
# ? May 28, 2012 19:09 |
|
You could try out Matt Gemmell's MAAttachedWindow instead: http://mattgemmell.com/2007/10/03/maattachedwindow-nswindow-subclass/ It has the added benefit of pre-Lion compatibility (if you care about such things).
|
# ? May 29, 2012 06:49 |
|
I'm not thrilled about the idea of implementing a popover from scratch, and GitHub's appear's to be tightly coupled with the rest of the Chameleon UI stuff, so that one's not super useful unfortunately. I might use MAAttachedWindow, but first I'm going to try and modify the design of my popover to work with the bordered area. Thanks for the links.
|
# ? May 29, 2012 07:04 |
|
pokeyman posted:GitHub for Mac uses Chameleon, so if you go the custom route, you can check out their implementation. I doubt it'll be worth outright lifting their classes but it might give you a head start. That looks loving awesome and it totally bookmarked now.
|
# ? May 30, 2012 00:57 |
|
I know Apps from the same developer can share certain permissions and capabilities, but if I create an AssetLibrary asset from one app, is it marked editable from another app (from the same developer)?
the talent deficit fucked around with this message at 04:35 on May 30, 2012 |
# ? May 30, 2012 04:30 |
|
Doc Block posted:RGBA8888 means you're getting 32-bit textures with full alpha transparency support. This is what you want if you are looking for textures that have smooth gradients and smooth alpha transparency instead of just on/off transparency. It takes up the most memory, though. Thanks.. I'm hoping it's the combination of blending modes. I'm going to read more about different blending modes and experiment to see if I can get rid of the problem.
|
# ? May 30, 2012 19:58 |
|
Gordon Cole let us know what you end up deciding about your popover situation because I've got a view that I'd like to display edge-to-edge in a popover as well. Can't believe there isn't an option for that
|
# ? May 30, 2012 21:03 |
|
I gave up and decided to just deal with the border I just drew a 1px rounded border around the content area and treated the inside as if it were the edge of the popover. It doesn't look that good but I'd rather not deal with the hassle of using a completely custom popover right now. If I had more time to spend on this, I'd take something like MAAttachedWindow and customize it to look how I need it. It'd be really annoying to emulate a bunch of standard behavior just for this one small customization though.
|
# ? May 30, 2012 23:05 |
|
I'm still fairly new at the whole thing but couldn't you manipulate the quartz layer size/position or will the popover container clip that?
|
# ? May 30, 2012 23:16 |
|
Ah, fair enough. I wonder if there is a way to deliver suggestions like this to Apple. It doesn't feel like something that ought to go into the Bug Reporter but I think that's actually exactly where it needs to be suggested.
|
# ? May 31, 2012 00:03 |
|
Martytoof posted:Ah, fair enough. To be honest, it's not really their design philosophy. Take the UIAlertView, which is basically impossible to modify. It takes a ton of work to roll your own, so it's a like setting a bar for developers: use our functional design, or you better know what you're doing if you make your own. Not saying it's always the best way, but it's sometimes worth it. Like not really being able to easily set the color of rounded rect buttons. It would be the easiest thing to implement, but they must be leaving it out to prevent lovely lovely buttons everywhere.
|
# ? May 31, 2012 00:30 |
|
xgalaxy posted:I'm still fairly new at the whole thing but couldn't you manipulate the quartz layer size/position or will the popover container clip that? I haven't really ever worked at that low of a level, so perhaps, but the popover seems pretty strict about clipping. I tried using setClip and a layer-backed view (I believe core animation layers are usually allowed to draw outside of their containing view) and neither worked.
|
# ? May 31, 2012 01:16 |
|
I might throw the question up on StackOverflow. That place has been pretty good for some obscure questions.
|
# ? May 31, 2012 01:40 |
|
the talent deficit posted:I know Apps from the same developer can share certain permissions and capabilities, but if I create an AssetLibrary asset from one app, is it marked editable from another app (from the same developer)? On a somewhat related question, there is a lot of old/outdated info out there about this but on iOS, is it possible to share files between two apps from the same developer without going through the UIDocumentInteraction? I am thinking no but wanted to check. It makes me wonder how stuff like a free/paid version of an app manage to share data. I have that issue right now - sometimes users buy the IAP in the free version then move to the paid version, but the IAP obviously doesn't come along.
|
# ? May 31, 2012 01:52 |
|
Today I was chasing around an iOS ARC circular reference issue that took forever to track down, most assuredly because I was using the wrong tools. This specific object is created after a login, held in one strong property, and discarded via self.object = nil on logout. The self.object = nil was being called on logout, but the object's dealloc was never running. A new login would spawn a duplicate object. Clearly something in the object was creating a circular reference that should be __weak. (It creates several other objects and sets itself as delegate.) After assuring that my one strong reference was being set to nil, I went to the allocations instrument. Viewing details on the object showed the initial allocation and nothing else. I temporarily nilled the strong reference immediately below its initialization, and instruments showed the object being released (verified correct). If memory serves, in a non-ARC environment, the allocations tool shows every retain and release, making it easy to track down these issues. Failing that, you can always override retain and release and throw in some break points. Neither of these seems to work in ARC. The issue ended up being a delegate property that had been recently converted from non-ARC to ARC holding a strong reference, of course, but it took several hours to track down. The problem object was set in the leaking object's init, but the problem did not happen if I immediately released the object after returning from its initialization. I found it by commenting out pieces of the problem object until the dealloc was called correctly. I ended up converting the rest of the project to ARC in a futile attempt to resolve the issue first, so I suppose that's a net benefit. What tools or methods did I miss?
|
# ? May 31, 2012 06:27 |
|
Martytoof posted:I might throw the question up on StackOverflow. That place has been pretty good for some obscure questions. You might also try the Cocoa-dev mailing list.
|
# ? May 31, 2012 06:45 |
|
ManicJason posted:After assuring that my one strong reference was being set to nil, I went to the allocations instrument. There's a Leaks instrument that's designed exactly for this kind of bug.
|
# ? May 31, 2012 18:05 |
|
|
# ? May 16, 2024 15:54 |
|
I didn't see anything in leaks at a glance and didn't expect to since this was a circular reference, not a leak. The object never deallocating when I freed my one strong reference was the problem.
|
# ? May 31, 2012 20:38 |