|
Hughlander posted:Anyone remember which WWDC 2012 talk was about C++11 features? Particularly lambdas/blocks? I want to pass an Obj C++ self inside a lambda to a C++ object that lives as a smart pointer in the obj C++ object, and want to make sure that it's not going to be maintaining strong references to each other because of it. If you're using ARC, then yes, self will be strong. Therefore, if you capture it by value, then the corresponding field of the lambda will be strong. Therefore you'll get a retain cycle exactly like you would with a block. But that cycle will be ephemeral unless the C++ object holds on to the lambda somehow (e.g. using a std::function).
|
# ? May 15, 2013 18:03 |
|
|
# ? May 22, 2024 13:39 |
|
rjmccall posted:If you're using ARC, then yes, self will be strong. Therefore, if you capture it by value, then the corresponding field of the lambda will be strong. Therefore you'll get a retain cycle exactly like you would with a block. Yes it would be held in a std::function, but no ARC. My use case was C++ class creates a pthread and a queue with a pthread conditional variable, calls std::function on success/fail of the operations. Obj C++ class creates the C++ class in an init method passing in a block of [self callbackSuccess]; Few other things going on using some crossplatform custom frameworks... In the end with the lifetime as it was listed I used lambda syntax in C++ and passed it as [=]{[self callbackSuccess];} At somepoint I want to understand why when I tried __block lambdaSelf = self; ^{[lambdaSelf callbackSuccess];} gave a bad access but that won't be today. (Unless the answer is that I didn't retain it / that only works under ARC?)
|
# ? May 16, 2013 02:13 |
|
Yeah, it looks like self is being deallocated before the block is executed, leaving you with a dangling pointer in lambdaSelf. Which then gives you a bad access when you try to do [lambdaSelf callbackSuccess].
Doc Block fucked around with this message at 03:13 on May 16, 2013 |
# ? May 16, 2013 02:47 |
|
Hughlander posted:Yes it would be held in a std::function, but no ARC. My use case was C++ class creates a pthread and a queue with a pthread conditional variable, calls std::function on success/fail of the operations. Obj C++ class creates the C++ class in an init method passing in a block of [self callbackSuccess]; Few other things going on using some crossplatform custom frameworks... In the end with the lifetime as it was listed I used lambda syntax in C++ and passed it as [=]{[self callbackSuccess];} Lambdas and blocks have similar basic capture semantics: when you capture a variable by copy (which is what happens with blocks when you refer to a non-__block variable), the block/lambda ends up with a copy of the variable. And in general, that variable (the "capture field") has precisely the same semantics as the original variable and gets copy-initialized using the normal language rules. However, there is a special case for non-ARC blocks: if the variable has an ObjC or block type, then when the block gets copied to the heap, the value in the capture field is retained (and released when the new heap block is deallocated). (This also happens by default in ARC, but it's not a special case: it falls out from the normal rules for copying __strong variables.) But that special case is just for blocks; capturing a variable of ObjC or block type in a lambda does not insert magic retains. So no retain cycles for you. Hughlander posted:At somepoint I want to understand why when I tried When you're not in ARC, variables are all unretained. When you capture a __block variable in a block, the block gets a strong reference to the variable, but that doesn't change the fact that the variable itself still holds its value as an unretained pointer. So yes, the problem is probably that the self object is getting deallocated because nothing is retaining it. rjmccall fucked around with this message at 03:07 on May 16, 2013 |
# ? May 16, 2013 03:05 |
|
I have a UICollectionView zIndex issue. The UICollectionViewCells contain popover interface elements that can bleed out of the cell bounds. The zIndex of the cells gets completely mixed around by the way I'm arranging them (this is fine). But I need a way to make sure these interface elements appear on top of the cells. I figure there are two options: 1. Try and move the user interacted-with cell to the top. How can I do this without creating an entire UICollectionViewLayout? 2. Try and make the popover visuals a subview of some superview. This seems really iffy. Any thoughts?
|
# ? May 20, 2013 02:49 |
|
For whatever view is bleeding, set its clipsToBounds property to YES, which will clip any parts of the view's sub views or custom drawing that fall outside the view's bounds. You could probably set it on the cell's contentView. There are performance implications, which is why the default is NO, but it sounds like you need it enabled. edit: or are the contents supposed to bleed?
|
# ? May 20, 2013 03:40 |
|
Yes, they're supposed to bleed. The problem is that other cells that are higher up on the zIndex chain cover it up.
|
# ? May 20, 2013 04:04 |
|
In the screenshots you posted, what is supposed to be happening? I'm assuming you want the Max Value field to be on top of the lines, right? In the screenshots, is the Max Value field what is extending beyond the bounds of the cell? Sorry if I seem dense. Doc Block fucked around with this message at 05:00 on May 20, 2013 |
# ? May 20, 2013 04:57 |
|
No worries - kind of weird to explain. There is a guide view that appears when the user starts to drag my 'nub.' If the cell it's in is on top of all the other cells, it looks like this (this is what is supposed to happen): If the cell is not on top, the guide view gets cropped at the bottom of the cell, which I don't want:
|
# ? May 20, 2013 15:30 |
|
A small question. The Data Formatting Guide states that:quote:For date and times in a fixed, unlocalized format, that are always guaranteed to use the same calendar, it may sometimes be easier and more efficient to use the standard C library functions strptime_l and strftime_l. except that, as far as I can tell, strptime_l and strftime_l aren't actually available. Anything I'm missing?
|
# ? May 20, 2013 15:40 |
|
Dumb question- did you #include <sys/time.h>? The POSIX API is not exposed to a stock project by default.
|
# ? May 20, 2013 15:42 |
|
lord funk posted:No worries - kind of weird to explain. Ok. I'd probably just make a container view that holds the lines and whatnot then. That way you're guaranteed it'll be on top. Make it a sub view of the viewcontroller's view, hidden until needed.
|
# ? May 20, 2013 16:01 |
|
Doc Block posted:Ok. I'd probably just make a container view that holds the lines and whatnot then. That way you're guaranteed it'll be on top. Make it a sub view of the viewcontroller's view, hidden until needed. I'm thinking the same at this point. There's no way I'm rolling my own collection view layout just for that one issue. Plus, even if I can push cells to the top, if a user drags two at a time, there's a chance one will still cover up the other.
|
# ? May 20, 2013 16:02 |
|
haveblue posted:Dumb question- did you #include <sys/time.h>? The POSIX API is not exposed to a stock project by default. <time.h> actually, <sys/time.h> is a little too low-level. The problem is that strftime_l (the variant of strftime where you can override the locale used without mucking with POSIX environment variables) is defined in the non-standard <xlocale/_time.h>, which is included in <time.h> if _USE_EXTENDED_LOCALES_ is defined. Now, _USE_EXTENDED_LOCALES_ is completely undocumented and I'm not sure whether I'm supposed to define it, or if it's defined by the build environment under certain conditions, or whatever e: I ended up using NSDateFormatter anyway
|
# ? May 20, 2013 16:44 |
|
Crashlytics good, yes? Better than the "live" reporting from TestFlight?
|
# ? May 20, 2013 17:59 |
|
hackbunny posted:<time.h> actually, <sys/time.h> is a little too low-level. The problem is that strftime_l (the variant of strftime where you can override the locale used without mucking with POSIX environment variables) is defined in the non-standard <xlocale/_time.h>, which is included in <time.h> if _USE_EXTENDED_LOCALES_ is defined. Now, _USE_EXTENDED_LOCALES_ is completely undocumented and I'm not sure whether I'm supposed to define it, or if it's defined by the build environment under certain conditions, or whatever I've done date stuff like this (needed because NSDateFormatter was too slow in my case): Objective-C code:
|
# ? May 20, 2013 18:10 |
|
Doc Block posted:Ok. I'd probably just make a container view that holds the lines and whatnot then. That way you're guaranteed it'll be on top. Make it a sub view of the viewcontroller's view, hidden until needed. Follow up: this worked really well. I pass a weak reference of the collection view controller's view to the cell view controller, which is the delegate of the nub UI elements. The nub handles adding / showing / hiding the view and can translate from local coordinates to the top VC coordinates. Works great!
|
# ? May 20, 2013 22:09 |
|
More fun with collection views. They're pretty cool, but the default layout rules are weird. Cells left justify, unless they are not in the final row, in which case they center justify... unless there are cells in previous rows, and the last row only has one cell. Quick justification demo: edit: wait I think that's my fault edit2: maybe not lord funk fucked around with this message at 23:27 on May 20, 2013 |
# ? May 20, 2013 23:21 |
|
I'm using TheAmazingAudioEngine to capture audio input, with a receiver object implementing a C callback that is called as part of the real-time audio thread (to transfer buffer data). I want to trigger a method off the completion of the callback, but as it is part of the audio thread it is not allowed to make any obj-c calls etc. I do have access to all the instance variables of the receiver object. The callback will run every 10 ms or so, so it needs to be pretty fast about it.
|
# ? May 21, 2013 00:56 |
|
catbread.jpg posted:I'm using TheAmazingAudioEngine to capture audio input, with a receiver object implementing a C callback that is called as part of the real-time audio thread (to transfer buffer data). you can't use Grand Central Dispatch to run a method on the main queue?
|
# ? May 21, 2013 03:05 |
|
lord funk posted:More fun with collection views. They're pretty cool, but the default layout rules are weird. Cells left justify, unless they are not in the final row, in which case they center justify... unless there are cells in previous rows, and the last row only has one cell. Weird. This is with flow layout?
|
# ? May 21, 2013 03:11 |
|
lord funk posted:More fun with collection views. They're pretty cool, but the default layout rules are weird. Cells left justify, unless they are not in the final row, in which case they center justify... unless there are cells in previous rows, and the last row only has one cell. Whoa. I'm just taking Bryan Hansen's UICollectionView tutorial (which btw everybody, is real good) and still only just starting to get a sense of what is possible with it. duck pond fucked around with this message at 10:03 on May 21, 2013 |
# ? May 21, 2013 10:01 |
|
catbread.jpg posted:I'm using TheAmazingAudioEngine to capture audio input, with a receiver object implementing a C callback that is called as part of the real-time audio thread (to transfer buffer data). Oh hey sup catbread. Yeah you wanna do what Doctor w-rw-rw- says basically, once you have the THIS object it should be as easy as code:
duck pond fucked around with this message at 10:24 on May 21, 2013 |
# ? May 21, 2013 10:14 |
|
Doc Block posted:Weird. This is with flow layout? Yes, and it is not okay for human consumption. I guess instead of 'flow' layout they should call it 'okay for image grids that don't change really' layout. I'm finding oddity after oddity. duck pond posted:Whoa. I'm just taking Bryan Hansen's UICollectionView tutorial (which btw everybody, is real good) and still only just starting to get a sense of what is possible with it. Checking this out. It's time to make my own layout.
|
# ? May 21, 2013 22:18 |
|
Making your own layouts isn't as hard as it sounds. NSScreenCast covered it in their UICollectionView episode.
Doc Block fucked around with this message at 23:26 on May 21, 2013 |
# ? May 21, 2013 23:24 |
|
Does anyone have experience using NUI (https://github.com/tombenner/nui) in an iOS application? It looks really neat, basically it allows for creating CSS like style sheets to quickly change the look of an application. Because I mostly use IB in development it's always such a pain for me when the shade of the predominant font in the app changes there is no single point to handle it, and NUI looks like it will make things like this far simpler. But yeah, basically I'm wondering if using this is going to make styling things as simple as Android styles/themes, or are there headaches this is going to bring to the table I'm unaware of?
|
# ? May 22, 2013 14:56 |
|
It's just a layer over UIAppearance, so I suppose it shouldn't be too bad. At least, it should be good enough to try out IMO.
|
# ? May 22, 2013 18:00 |
|
Doctor w-rw-rw- posted:It's just a layer over UIAppearance, so I suppose it shouldn't be too bad. At least, it should be good enough to try out IMO. It seems a bit more useful than UIAppearance at least, UILabels for instance don't appear to be supported in UIAppearance but it looks like NUI handles them. UILabel support is what drove me away from just using UIAppearance. edit: Here's a kind of helpful list of what UIAppearance can handle: https://gist.github.com/mattt/5135521 Glimm fucked around with this message at 18:26 on May 22, 2013 |
# ? May 22, 2013 18:13 |
|
Due to customer privacy concerns, we now have to roll our own crash reporting logs and submit them to our own servers. I'm trying out Plcrashreporter but it's actually crashing when handling an uncaught exception. Anyone have experience making their own?
|
# ? May 22, 2013 21:57 |
|
Doh004 posted:Due to customer privacy concerns, we now have to roll our own crash reporting logs and submit them to our own servers. I'm trying out Plcrashreporter but it's actually crashing when handling an uncaught exception. What SHA of PlCrashReporter? We use 2.0 beta1, SHA: a24b93f01a87073ccd7113a8615a9304de47dbe5 and it's pretty drat Metal.
|
# ? May 23, 2013 02:03 |
|
Hughlander posted:What SHA of PlCrashReporter? We use 2.0 beta1, SHA: a24b93f01a87073ccd7113a8615a9304de47dbe5 and it's pretty drat Metal. There's a 2.0 out? I just downloaded the "Featured" one: 1.1 RC2: f31296756a572d544a206116d3adf33bd6cde654 http://code.google.com/p/plcrashreporter/downloads/detail?name=PLCrashReporter-1.1-rc2.dmg&can=2&q= Perhaps I should try out 2.0. I also had no idea what I was doing. I had to build the .a file from the source and I doubt I did that correctly. I tried to follow: http://stackoverflow.com/questions/6192897/plcrashreporter-in-xcode-4-wont-compile-in-simulator
|
# ? May 23, 2013 15:20 |
|
Is this just a popover with a UISegmentedControl, or is it a particular object I can't find on Google? I need coffee.
|
# ? May 23, 2013 15:38 |
|
It's UIMenuController. Good luck.
|
# ? May 23, 2013 15:44 |
|
pokeyman posted:It's UIMenuController. Thanks. Also why is this so hard to make it appear. lord funk fucked around with this message at 16:37 on May 23, 2013 |
# ? May 23, 2013 16:29 |
|
lord funk posted:Thanks. Also why is this so hard to make it appear. Not sure about this, but one thing to look out for when using UIMenuController is to be sure to use the sharedMenuController instance (http://developer.apple.com/library/...dMenuController). Bad things can happen otherwise!
|
# ? May 23, 2013 16:34 |
|
Glimm posted:Not sure about this, but one thing to look out for when using UIMenuController is to be sure to use the sharedMenuController instance (http://developer.apple.com/library/...dMenuController). Bad things can happen otherwise! Got that, but the class reference poorly documents the required responder calls. You have to override -(BOOL)canBecomeFirstResponder to return YES, you have to call [self becomeFirstResponder], and you have to implement -(BOOL)canPerformAction:withSender:. From the docs: quote:The canPerformAction:withSender: method of UIResponder is also related to the editing menu. Okay, but just let me know it's required. lord funk fucked around with this message at 16:44 on May 23, 2013 |
# ? May 23, 2013 16:41 |
|
lord funk posted:Thanks. Also why is this so hard to make it appear. UIMenuController is depressingly hard to customize, and documentation is sparse (as you've already found). If you want to use it within a text view or table view, it might be worth using. Otherwise I'd just make my own control. When I'm been stuck with it, I find PSMenuItem helpful; it turns the responder chain garbage into blocks. (I'm familiar with the responder chain in general and it's great, but UIMenuController shits the bed here.) And at some point I came across UIMenuItem (CXAImageSupport) but haven't had a chance to use it yet. That one lets you use images in the menu items, like the bold/italic/underline items in Mail.
|
# ? May 23, 2013 16:45 |
|
Doh004 posted:There's a 2.0 out? I just downloaded the "Featured" one: 1.1 RC2: f31296756a572d544a206116d3adf33bd6cde654 http://code.google.com/p/plcrashreporter/downloads/detail?name=PLCrashReporter-1.1-rc2.dmg&can=2&q= It works! Turns out you can't run it in Simulator (something I probably should have guessed), but running it on devices actually works. Now, to figure out how to get an actual stack trace out of all of this.
|
# ? May 23, 2013 17:12 |
|
Sorry for the double post but now we're stumped. PLCrashReporter is working fine when we build to a device, but in our CI (TeamCity) we get this error:code:
Am I missing something obvious here?
|
# ? May 23, 2013 23:13 |
|
|
# ? May 22, 2024 13:39 |
|
Release vs debug mode? Missing copy/include in a build phase?
|
# ? May 23, 2013 23:15 |