|
status posted:
For this sort of thing just take advantage of the fact that sending -valueForKey: to an array returns an array collecting the result of sending -valueForKey: to each of its members: code:
Key-Value Coding (KVC) is really powerful and worth leveraging every chance you get. Same with NSPredicate which is built atop it. Also, in general it's also better to use real objects when you can instead of dictionaries with known keys and values. KVC will still work thanks to the magic of the Objective-C runtime.
|
# ? Dec 13, 2013 11:30 |
|
|
# ? May 22, 2024 16:04 |
|
I have a method that iterates over a bunch of files to change the file metadata, then save them. I would like to know when they're all done, but I'm not sure how to get a single 'did finish' notification instead of a bunch of individual notifications.Objective-C code:
|
# ? Dec 13, 2013 19:07 |
|
You could have the if (success) {} bit increment an integer, and if the integer is equal to the count of patches, post the final notification. You'd need to handle failure as well.
|
# ? Dec 13, 2013 19:34 |
|
^^^ YOU SON OF A BITC... Maybe have an int that you're observing and increment it each time it finishes. Then in your observing method, if that int is the same number as the count of documents you're done? Kinda ghetto but it'd work?
|
# ? Dec 13, 2013 19:35 |
|
Oh duh. I thought I couldn't do that because of the block syntax but you can just use int __block counter = 0 in the declaration. Thanks!
|
# ? Dec 13, 2013 20:41 |
|
God drat just did it:Objective-C code:
|
# ? Dec 13, 2013 21:52 |
|
Or use dispatch groups and block one on a background thread and dispatch to main after it unblocks.
|
# ? Dec 13, 2013 22:53 |
|
lord funk posted:God drat just did it: Objective-C code:
|
# ? Dec 14, 2013 01:15 |
|
Maybe Clang should detect that getter pattern and warn about the mistake.
|
# ? Dec 14, 2013 22:56 |
|
Plorkyeran posted:This is why I now use a macro for lazy properties. Not because it saves four lines of code, but to avoid stupid typos and mistakes. Just to vent: I'm getting really tired of Instruments causing the iPad to freeze completely. If I don't quit Instruments between each run it happens every time. And if I never see 'tintColor' again in my life I'll die happy. Holy god.
|
# ? Dec 14, 2013 23:24 |
|
Toady posted:Maybe Clang should detect that getter pattern and warn about the mistake. I'm surprised the static analyzer doesn't detect infinite recursion in the simple case. (I know halting problem but I mean a literal recursive path with no branches)
|
# ? Dec 15, 2013 00:15 |
|
Does anyone else have experience with Smart Banners? How the hell do I develop for this? It seems to only work with the app store version of the app and not the in development version that I've put onto my test devices (I know the simulator doesn't work). A couple SO questions say you can build the app onto the device after installing from the App Store - which seems to work - however; "- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation" doesn't get called when doing this and I need to pass in the arguments. Anyone have any idea? *edit* It appears this is a known issue with iOS7? https://devforums.apple.com/message/897373#897373 Doh004 fucked around with this message at 19:34 on Dec 18, 2013 |
# ? Dec 18, 2013 18:00 |
|
Hughlander posted:I'm surprised the static analyzer doesn't detect infinite recursion in the simple case. (I know halting problem but I mean a literal recursive path with no branches) If you file it, it would be a great little project to give to a new employee or intern.
|
# ? Dec 18, 2013 19:38 |
|
edit: source of the problem found and it doesn't have to do with item ordering. Feel free to discuss if you know the answer though! NSLayoutConstraint question regarding first and second items. I ran into a situation where I was building a top and bottom constraint manually and though the layout worked I was getting a broken constraint warning at runtime. I then built the same constraints using the visual format language and the warning went away. I started digging into why and found that the firstItem and secondItem properties were different depending on how I built the constraints. I'm trying to understand, in the general case, which is the first item and which the second but I haven't found anything useful. Example: Objective-C code:
Objective-C code:
Anyone have any insight on this? I can fix this easily enough by just doing what the visual format does but I'd like to understand what exactly the meaning of "first" and "second" item are. IMPORTANT EDIT: the act of posting this problem here made me take a closer look and it turns out the constraint breakage is actually caused by a transient bad height calculation in -viewWillLayoutSubviews and has nothing to do with the ordering of the items in the constraints. I still don't know what Apple intends by "first" and "second" but it doesn't seem to matter in my particular case. Welp. Dr Monkeysee fucked around with this message at 22:11 on Dec 18, 2013 |
# ? Dec 18, 2013 21:47 |
|
Monkeyseesaw posted:Unfortunately the Apple documentation only refers to the first item as the "left side of the expression" and the second item as the "right side of the expression" which doesn't clarify anything. Auto Layout Guide posted:
First item is y, second item is x. This is not particularly well noted in the docs and is worth you pressing that "Send Feedback" button.
|
# ? Dec 18, 2013 23:00 |
|
I'm having a problem with audio in the iOS simulator. I basically don't hear any sound output from the app. When I start the app in the 7.0 simulator, I no longer hear music playing in the background (in iTunes), and I also don't hear the blips when I raise/lower the volume via the keyboard buttons. If I stop the simulator app, itunes music and volume blips come back. With the 6.1 simulator, I do hear background music and the volume change blips, but also no audio from the app. When I run the app on a device (running 6.1) I hear the app audio fine. I had been messing around with soundflower but I have turned it all off, rebooted etc. It seems like the simulator app is choosing some audio output which is not actually sending any output, and I cant see where to configure. I've tried headphones/no headphones, resetting the simulator and double checked my audio midi setup which looks all correct. I am using CoreAudio and this is my output unit code:
|
# ? Dec 19, 2013 08:52 |
|
I don't think I have ever had a not-janky audio experience when working in the simulator. That's just been one of those cases where I had to work on a real device.
|
# ? Dec 19, 2013 14:46 |
|
Yeah, the Simulator audio situation typically ranges from janky to crashy in ways that don't show up on the device at all.
|
# ? Dec 19, 2013 20:27 |
|
It's been fine so far oh well
|
# ? Dec 19, 2013 21:37 |
|
pokeyman posted:[url=https://developer.apple.com/library/ios/documentation/userexperience/conceptual/AutolayoutPG/AutoLayoutConcepts/AutoLayoutConcepts.html#//apple_ref/doc/uid/TP40010853-CH14-SW1] That does help. Thanks. It also shows that my ordering of first and second item in my two constraints is correct so it's interesting the visual format swaps them for the bottom constraint. Fortunately it doesn't seem to matter, at least in this particular case. edit: feedback sent Dr Monkeysee fucked around with this message at 23:50 on Dec 19, 2013 |
# ? Dec 19, 2013 23:36 |
|
Apparently it's screw Core Audio week. I am attempting to move some audio queue code to audio units. I now have it working at double speed, meaning my playback is a double speed robotic version of what I record. I'm sure there's something goofy with my data format somewhere, but it all looks fine after banging my skull into them for a few hours. edit: I was getting tiny buffers in my play callback and not using a rolling buffer like I should have been. Silly me. ManicJason fucked around with this message at 08:10 on Dec 20, 2013 |
# ? Dec 20, 2013 01:08 |
|
So, Facebook released a thing: http://facebook.github.io/origami/ https://code.facebook.com/posts/604847252884576/2013-a-year-of-open-source-at-facebook/ quote:Origami is a free toolkit for Quartz Composer—created by the Facebook Design team—that makes interactive design prototyping easy and doesn’t require programming. Haven't got to play with it yet but seems really cool
|
# ? Dec 20, 2013 21:43 |
|
Glimm posted:So, Facebook released a thing: You wouldn't believe what kinds of things they've prototyped with it. This is a tool that the industry's best designers use or should use.
|
# ? Dec 21, 2013 03:12 |
|
Sound now works in the simulator vv Must've been a bug somewhere in my code. I have nfi what fixed it.
|
# ? Dec 21, 2013 12:59 |
|
I've use quartz composer for some neat image editing tricks sans photoshop. I imagine it's useful for prototyping all those fancy photo filter apps.
|
# ? Dec 21, 2013 20:55 |
|
Doctor w-rw-rw- posted:You wouldn't believe what kinds of things they've prototyped with it. This is a tool that the industry's best designers use or should use. I wish I had time to learn it. I goofed around a bit when Facebook revealed they prototyped with it, and suddenly there were a ton of 'hello world' tutorials coming out, but nobody ever seemed to move past that point. If only I didn't have to fill every other role on all our iOS and web projects as well... Then I'd feel justified in taking a week and just goofing off with composer.
|
# ? Dec 23, 2013 02:35 |
|
It's taken a while, but I finally get the fact that many of the Apple supplied UI elements just aren't for apps that want a custom look. I just finished rolling my own UIAlertView so I can have control over font, color, and not have it fly all over the screen with UIDynamics. I have a few UI elements I'll post here once this project is done. Edit: lord funk fucked around with this message at 18:03 on Dec 27, 2013 |
# ? Dec 27, 2013 16:50 |
|
code:
|
# ? Dec 29, 2013 05:27 |
|
ManicJason posted:Well, that sure makes sense. My destination view controller, an id, is not even an Objective-C object. That's brilliant and makes perfect sense, I'm sure. The type of the property is immaterial here. If the object the property refers to was deallocated before you attempted to use it, the pointer you get back from the property could be garbage. (Unless the property or variable is specified to be a zeroing weak reference. Which I'm guessing it's not.) Run the static analyzer and also run your app with zombies enabled, that will help you catch memory management issues.
|
# ? Dec 29, 2013 07:15 |
|
To be fair, compared to some IDE debuggers like VS, the Xcode/LLDB experience leaves something to be desired. NSDictionary you say? What are the keys and values? Hmmm I don't think 0x8df01234 is the correct answer. To be fair, some of this has gotten better recently but it's still poo poo for just showing me the drat contents of my objects. I'm not even going to get into stuff like patching in live code changes.
|
# ? Dec 29, 2013 16:33 |
|
The frustrating thing about that is that showing the contents of collections works just often enough to make me expect it to work, making all the times when it doesn't work for no apparent reason all the more disappointing.
|
# ? Dec 29, 2013 16:48 |
|
My favorite is trying to peek into an NSIndexPath. code:
|
# ? Dec 29, 2013 18:50 |
|
I have no idea what you guys are doing to cause that. I print out NSDictionarys and NSIndexPaths probably 50 times a day and have never run into that. How does it happen?
|
# ? Dec 29, 2013 20:15 |
|
Same here. Using po (print object) on an NSIndexPath calls -description, which returns something like this: <NSIndexPath 0x79509d0> 2 indexes [0, 0]
|
# ? Dec 29, 2013 21:03 |
|
status posted:I have no idea what you guys are doing to cause that. I print out NSDictionarys and NSIndexPaths probably 50 times a day and have never run into that. How does it happen? What lord funk showed was what happens when you twist open a variable pointing to an NSIndexPath, which shows its ivars rather than its logical contents.
|
# ? Dec 29, 2013 22:57 |
|
eschaton posted:What lord funk showed was what happens when you twist open a variable pointing to an NSIndexPath, which shows its ivars rather than its logical contents. Correct. In VS, I don't have to manually invoke the debugger like an animal. Of course the VS debugger understands that the properties really exist (po obj.abc not found, po [obj abc] works. Arggg) and knows how to lookup return values even when they are structs so no casting is required. I'm not annoyed that this doesn't work, I'm annoyed that a company with 150 billion in the bank couldn't hire an intern to crank out that feature across three major releases of their IDE. Something VB 5 did in 1997.
|
# ? Dec 30, 2013 02:10 |
|
I thought dot syntax works correctly now in the debugger. It's still infuriating that you can type [someArray co..] and have it pop up with "-(NSUInteger) count" then spit back unknown return type if you don't cast the result.
|
# ? Dec 30, 2013 02:14 |
|
ManicJason posted:I thought dot syntax works correctly now in the debugger. someView.bounds anyone?
|
# ? Dec 30, 2013 10:42 |
|
Ender.uNF posted:I'm not annoyed that this doesn't work, I'm annoyed that a company with 150 billion in the bank couldn't hire an intern to crank out that feature across three major releases of their IDE. Something VB 5 did in 1997. Unrelated: forgot that you can't submit an app with a beta SDK. Only took me an hour of dancing with provisioning to remember. Edit: Ugh. Add an entitlement to your app? Don't worry, Xcode's Capabilities feature will lord funk fucked around with this message at 17:27 on Dec 30, 2013 |
# ? Dec 30, 2013 16:25 |
|
|
# ? May 22, 2024 16:04 |
|
LLDB has supported dot notation for at least two years.
|
# ? Dec 30, 2013 17:24 |