|
Doctor w-rw-rw- posted:I guess having varargs be char * is nice. I have an inkling on why that's important, but just to be sure - why? The main thing is that all the variadic arguments are passed on the stack. This means that (1) the compiler has to know which arguments are variadic, which means user code has to call variadic functions using a correct function prototype, but also (2) it is much, much faster to process variadic arguments in the callee because you don't have to essentially undo the calling convention.
|
# ? Mar 26, 2014 21:33 |
|
|
# ? Jun 5, 2024 19:44 |
|
rjmccall posted:The main thing is that all the variadic arguments are passed on the stack. This means that (1) the compiler has to know which arguments are variadic, which means user code has to call variadic functions using a correct function prototype, but also (2) it is much, much faster to process variadic arguments in the callee because you don't have to essentially undo the calling convention. If they are on the stack, please tell me we can walk them and discover their types? (I know the answer is no, but I want it to be yes). I think my hate of how varargs is designed now borders on the irrational.
|
# ? Mar 27, 2014 06:01 |
|
A thing I learned yesterday: if you get an error code that makes sense neither in decimal (560557684) nor hexadecimal (0x21696E74), it's probably ASCII in disguise ("!int"). Put it in Calculator.app in programmer mode, and enable the "ASCII" toggle to see the hidden value. Now, the SDK headers that define ASCII error codes include both the decimal and hexadecimal equivalents in comments, so you can just grep for the number, but if you need a little peace of mind and a quick confirmation that the number isn't garbage, try this e: oh wow, a cool feature of Calculator.app I didn't know about: if you click on a digit in the binary view, you can toggle that bit hackbunny fucked around with this message at 10:22 on Mar 27, 2014 |
# ? Mar 27, 2014 10:19 |
|
I just got a crash possibly from passing the incorrect integer value to a method. The thing that is strange is first off this just suddenly happened after changing nothing that I can recall, and I can see that the object is an NSNumber and the value inside is correct, but for some reason getting the intValue of that gives me something that looks like a memory address. ThingKind is an enumerator. Edit: I fixed it by switching around the order I add objects. The interactionIndex changed after another object was added, but still strange to me that the NSNumber says the correct number but charName is different. LP0 ON FIRE fucked around with this message at 18:15 on Mar 27, 2014 |
# ? Mar 27, 2014 16:50 |
|
Apple, you make me sadquote:dispatch_sync How can the two things be true at the same time? At least the deadlock is documented...? e: I guess there isn't a 1:1 correspondence between threads and queues
|
# ? Mar 27, 2014 18:19 |
|
hackbunny posted:e: I guess there isn't a 1:1 correspondence between threads and queues Correct—that's the key thing about queues - only obvious exception being dispatch_get_main_queue(), I believe.
|
# ? Mar 27, 2014 18:32 |
|
Except how can I tell if the argument is the same as the current queue, if dispatch_get_current_queue is deprecated? I just want to run code on the main thread synchronously, why does it have to be so hard e: and we're back to old reliable -[NSObject performSelector:onThread:withObject:waitUntilDone:] hackbunny fucked around with this message at 18:40 on Mar 27, 2014 |
# ? Mar 27, 2014 18:37 |
|
hackbunny posted:Except how can I tell if the argument is the same as the current queue, if dispatch_get_current_queue is deprecated? What kind of case are you looking at here? Is there a reason you're trying to do this synchronously, potentially on the same queue, and not just running the code immediately?
|
# ? Mar 27, 2014 18:42 |
|
hackbunny posted:Except how can I tell if the argument is the same as the current queue, if dispatch_get_current_queue is deprecated? I just want to run code on the main thread synchronously, why does it have to be so hard Objective-C code:
|
# ? Mar 27, 2014 18:47 |
|
^^^ ugh of course, I'm an idiotultramiraculous posted:What kind of case are you looking at here? Is there a reason you're trying to do this synchronously, potentially on the same queue, and not just running the code immediately? Singleton initialized on arbitrary thread, I'm trying to wrap the call to -init in a dispatch_sync(dispatch_get_main_queue(), ...) to fix a race condition that's hard to pin down, but the more I think about it the less sense it makes e: I remember now, the thread that initializes the singleton is going to become the official dispatcher of callbacks from ABAddressBookRegisterExternalChangeCallback for the rest of the lifetime of the process, so it had better be the main thread hackbunny fucked around with this message at 18:54 on Mar 27, 2014 |
# ? Mar 27, 2014 18:47 |
|
Pretty cool when your first App is in review to see the Apple tester/reviewer guy login. (At least I know login is working )
|
# ? Mar 27, 2014 19:37 |
|
Alternately it's infuriating for it to sit in review for a week and then flip to ready for sale, yet your backend logs show they didn't even open the app once.
|
# ? Mar 27, 2014 22:29 |
|
Ender.uNF posted:If they are on the stack, please tell me we can walk them and discover their types? (I know the answer is no, but I want it to be yes). Why would being on the stack affect that...? If you want dynamically-discoverable types, you should almost certainly just use some C++11 variadic template trick. Ender.uNF posted:I think my hate of how varargs is designed now borders on the irrational. The kind of type reflection that would enable the feature you're talking about is completely incompatible with the philosophy of C. pokeyman posted:
The real answer is "you should be much more conscious of what queue any particular bit of code is allowed to run on". Some utility code can make sense to execute on an arbitrary thread, sure. Event-management code that's actively jockeying tasks between queues? There is basically no sane design where you don't know what queue is responsible for running that. If you really need a few places to detect whether it's running on the main queue because some crappy API is subverting your queue design, then okay, but if you're pervasively writing code that doesn't know what queue it's on, then you probably either have massive races or you're writing really inefficient single-threaded code.
|
# ? Mar 27, 2014 22:45 |
|
kitten smoothie posted:Alternately it's infuriating for it to sit in review for a week and then flip to ready for sale, yet your backend logs show they didn't even open the app once. Well thankfully they rejected it just after two days, and were really clear about what guideline I wasn't following. I was actually kind of thankful since there were two more bugs I found since uploading. Those bugs were minor and I was alright with releasing to the public, but are nice to now have fixed.
|
# ? Mar 27, 2014 23:18 |
|
Apple App Review Team: helping developers get in those couple extra minor bug fixes before release since 2008.
|
# ? Mar 27, 2014 23:29 |
|
rjmccall posted:The real answer is "you should be much more conscious of what queue any particular bit of code is allowed to run on". Some utility code can make sense to execute on an arbitrary thread, sure. Event-management code that's actively jockeying tasks between queues? There is basically no sane design where you don't know what queue is responsible for running that. If you really need a few places to detect whether it's running on the main queue because some crappy API is subverting your queue design, then okay, but if you're pervasively writing code that doesn't know what queue it's on, then you probably either have massive races or you're writing really inefficient single-threaded code.
|
# ? Mar 28, 2014 00:02 |
|
Plorkyeran posted:Every single app I've worked on has needed if ([NSThread isMainThread) { ... } at some point (or a moral equivalent), and every time it's been due to a design fuckup. In general GCD seems to make threading easy enough that people can produce something that works, but not easy enough for something that's correct. I would agree with that. GCD is a nice solution to some fairly narrow technical problems, but ultimately I think you need a language-level technology to really encourage a good design by locking down the thread-of-control interactions between subsystems — and I'm not sure how you could realistically impose that sort of thing retroactively, or that it would even produce a good environment given a clean slate. Competing approaches like Go's don't seem well-suited to GUIs, and things like FRP entail pretty radical changes to the language. It's a hard problem.
|
# ? Mar 28, 2014 00:50 |
|
We had an update take 3 months to get in, twice rejected after multiple weeks in-queue because of content served in a web view. Not "hey, fix that content somehow so that the partner's page doesn't link as directly to a non-Apple payment system, and we'll approve it", but right to the back of the line. Another time in that sequence was because of a server outage. This content changed daily anyway, and in major functional ways every week, and they knew it. And then we found this gem on memegenerator, no doubt from an Apple review team person. Good times. ObContent: there used to be a library you could link that would let a target program turn on/off Shark profiling for itself. It was super helpful to expose to app script or similar to get clean profiles. I don't think that framework is around any more, but maybe someone knows of a way to do it? (At one point a co-worker was sending raw Mach messages and it worked, but that was a couple of years ago and er gross.) Edit: fixed link; I swear I copied it from my browser! Subjunctive fucked around with this message at 01:11 on Mar 28, 2014 |
# ? Mar 28, 2014 00:52 |
|
rjmccall posted:things like FRP entail pretty radical changes to the language.
|
# ? Mar 28, 2014 01:09 |
|
kitten smoothie posted:Alternately it's infuriating for it to sit in review for a week and then flip to ready for sale, yet your backend logs show they didn't even open the app once. IMO the App Review Team is one of this decade's biggest mysteries. I've had apps get opened for milliseconds and approved, others just incomprehensibly stared at for ours, others logged in once without doing a single thing, etc etc - I guess once you realise their original purpose is to make sure the app a) doesn't crash, b) looks the same as the screenshots you provide and seems to do what it does in the description and c) doesn't blatantly violate some specific guideline of your category, you also realise that they probably don't even have to go through the app at all most of the time. With that said though I still really wanna know what really goes on in those offices which I can only assume are buried deep in rural North Korea or something.
|
# ? Mar 28, 2014 11:41 |
|
rjmccall posted:The real answer is "you should be much more conscious of what queue any particular bit of code is allowed to run on". Some utility code can make sense to execute on an arbitrary thread, sure. Event-management code that's actively jockeying tasks between queues? There is basically no sane design where you don't know what queue is responsible for running that. If you really need a few places to detect whether it's running on the main queue because some crappy API is subverting your queue design, then okay, but if you're pervasively writing code that doesn't know what queue it's on, then you probably either have massive races or you're writing really inefficient single-threaded code. This app was written by outsourcers, educated idiots and uneducated idiots, with random contributions from whoever was free to plug the hole of the week. The sanest way to avoid synchronization issues is to run everything on the main thread, because there are no locks anywhere, and a lot of background threads. One of our core components is a C library that creates half a dozen background threads with the POSIX threads API, and its work queues are based on motherfucking select. Of course it calls back into Objective C code, which may or may not know about the absence of a dispatch queue or even an autorelease pool, depending on which of the six previous idiot savant/code janitor developers worked on a specific callback Usually, dispatch_async is fine, but an initialization routine can't run asynchronously: you'd return before the initialization is done, with the object in an indefinite state, so dispatch_sync it is
|
# ? Mar 28, 2014 12:19 |
|
Speaking of which, anyone knows of a way to diagnose deadlocks with pthreads locks? I need to know what threads hold what locks and I'm drawing a blank. The lock structure is opaque and I can't find any debugger commands to inspect them
|
# ? Mar 28, 2014 12:23 |
|
wakachamo posted:IMO the App Review Team is one of this decade's biggest mysteries. I've had apps get opened for milliseconds and approved, others just incomprehensibly stared at for ours, others logged in once without doing a single thing, etc etc - I guess once you realise their original purpose is to make sure the app a) doesn't crash, b) looks the same as the screenshots you provide and seems to do what it does in the description and c) doesn't blatantly violate some specific guideline of your category, you also realise that they probably don't even have to go through the app at all most of the time. It sounds a ton like patent examiners honestly. Some just reject to make a count, others scrutinize, some just gently caress around until its "time" for another. Sounds kinda soul-sucking. Imagine the amount of bullshit they have to deal with everyday with all the crappy bird / total clone / engrish day in, day out.
|
# ? Mar 28, 2014 13:56 |
|
Aside from keeping things more "organized", is there a reason to register your own defaults as opposed to just using standardUserDefaults to store some settings (in NSUserDefaults)? As long as I prefix all of my keys with my own App's naming scheme, I should be fine right?
|
# ? Mar 28, 2014 16:03 |
|
Doh004 posted:Aside from keeping things more "organized", is there a reason to register your own defaults as opposed to just using standardUserDefaults to store some settings (in NSUserDefaults)? As long as I prefix all of my keys with my own App's naming scheme, I should be fine right? I don't understand your question. You are free to use NSUserDefaults as you see fit in your application, no prefix necessary. If you're writing a library, use a prefix to avoid collisions (see also: category method names). There is no reason to make your own settings system to circumvent NSUserDefaults.
|
# ? Mar 28, 2014 16:11 |
|
The registerDefaults call is used to set the initial values of keys in NSUserDefaults, if you need them to not be zero/nil/empty for some reason. It's still using the same NSUserDefaults singleton and backing store.
|
# ? Mar 28, 2014 16:13 |
|
Ah okay, then yeah I got confused as to what that did. I thought you could say add your own singleton, [NSUserDefaults myCustomDefaults]. But I don't really see the need for it as the standardUserDefaults is already specific to your app for that user. Thanks for the clarification. Now on to enabling push notifications!
|
# ? Mar 28, 2014 16:16 |
|
If I have a long title on a navigation bar, it cuts off the back button's text to only show the chevron. Is there a way to force iOS to clip more off the navigation bar and show the full text of the back button?
|
# ? Mar 28, 2014 16:18 |
|
Peanut and the Gang posted:If I have a long title on a navigation bar, it cuts off the back button's text to only show the chevron. Is there a way to force iOS to clip more off the navigation bar and show the full text of the back button? I don't believe so. Perhaps when you set the title, truncate it at a certain amount of characters?
|
# ? Mar 28, 2014 16:32 |
|
hackbunny posted:Speaking of which, anyone knows of a way to diagnose deadlocks with pthreads locks? I need to know what threads hold what locks and I'm drawing a blank. The lock structure is opaque and I can't find any debugger commands to inspect them I mean for pthreads there's nothing that "holds" a lock. It's just a counter. Log statements on mutex lock/unlocks can be pretty helpful here. Also: Whyyyyyyyy
|
# ? Mar 28, 2014 17:16 |
|
Doh004 posted:I don't believe so. Perhaps when you set the title, truncate it at a certain amount of characters? Gotcha. I'll see how fruitful that direction is.
|
# ? Mar 28, 2014 19:38 |
|
*edit* Big rear end post about getting push notification development set up that worked itself out after turning airplane mode on and off for me, sorry about that.
Doh004 fucked around with this message at 01:08 on Mar 31, 2014 |
# ? Mar 28, 2014 20:18 |
|
Peanut and the Gang posted:If I have a long title on a navigation bar, it cuts off the back button's text to only show the chevron. Is there a way to force iOS to clip more off the navigation bar and show the full text of the back button? Totally untested and not sure this is exactly what you want, but you might be able to do something like this: code:
|
# ? Mar 31, 2014 01:17 |
|
samiamwork posted:Totally untested and not sure this is exactly what you want, but you might be able to do something like this: Sadly I think the back button doesn't extend from UIView in iOS 7. So something like that won't work out.
|
# ? Mar 31, 2014 14:59 |
|
Peanut and the Gang posted:Sadly I think the back button doesn't extend from UIView in iOS 7. So something like that won't work out. I'm fairly sure it's descends from UIView (I can see all the subviews when I walk the navbar's view hierarchy) but it appears that it's not as easy to get to the actual button's view as I assumed. You'd probably have to do some things that Apple would frown on which ends up having the same sad outcome. =( Sorry for the distraction.
|
# ? Apr 1, 2014 05:49 |
|
WWDC tickets are by lottery this year: https://developer.apple.com/wwdc/tickets/ Given last year's debacle, it's the only reasonably fair way to do it. Go put your hat in the ring.
|
# ? Apr 3, 2014 15:10 |
|
Ender.uNF posted:WWDC tickets are by lottery this year: https://developer.apple.com/wwdc/tickets/ Yeah this is fair. Entered, and good luck to everyone here!
|
# ? Apr 3, 2014 16:20 |
|
Much much better than last year. Hopefully we all get lucky (we won't)
|
# ? Apr 3, 2014 16:36 |
|
Is it possible to do iOS development on a windows or linux machine? e: how lovely is it? Newf fucked around with this message at 12:35 on Apr 4, 2014 |
# ? Apr 4, 2014 12:12 |
|
|
# ? Jun 5, 2024 19:44 |
|
Newf posted:Is it possible to do iOS development on a windows or linux machine? In theory you can run OS X in Virtualbox using some stuff that is shadier than the average Hackintosh setup so I'd call it and not discuss it in detail here. In practice it will run so lovely that you'll try it and immediately go to the Apple Store and buy a cheap Mac mini out of anger and frustration. I have no idea, for instance, if you'd be able to debug on a device through whatever USB bridging done by a VM.
|
# ? Apr 4, 2014 14:31 |