Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
I've had no luck getting symbols in instruments in several versions of Xcode. My coworker has the exact same toolset and gets symbols no problem both while launching in profile mode from Xcode and attaching to the process later. :shrug:

Adbot
ADBOT LOVES YOU

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
Obligatory "nuke your DrivedData"

Doc Block
Apr 15, 2003
Fun Shoe
A lot of the time I don't even bother Googling for solutions to Xcode problems until I've verified that closing Xcode & then running fuxcode doesn't fix it.

But I don't have Xcode problems very often...

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
The last time I tried to symbolicate something in instruments, I fuxcode, clean, build, and tried manually adding symbols with the dSym file. Nothing worked. I was not surprised.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
It pleases me to no end that someone else has an alias called fuxcode :3:

Doc Block
Apr 15, 2003
Fun Shoe
I have it because somebody posted it right here in this thread.

Doh004
Apr 22, 2007

Mmmmm Donuts...
I think I missed that posting. :unsmith:

lord funk
Feb 16, 2004

Rather than kick the can further down the road, I'm finally sitting myself down and learning Core Data. I don't think I'll go the full iCloud backup route just yet, but I'm looking forward to getting undo into my app. Any tips / warnings for a beginner?

edit: on second thought, ughhhhh.

edi2: gahhhh I really need to do this.

lord funk fucked around with this message at 18:56 on Aug 18, 2013

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

lord funk posted:

Rather than kick the can further down the road, I'm finally sitting myself down and learning Core Data. I don't think I'll go the full iCloud backup route just yet, but I'm looking forward to getting undo into my app. Any tips / warnings for a beginner?

You can certainly get undo into your app without Core Data, so if that's the only reason for learning then stop right now.

Other than that, I've found that there's an uncommonly large amount of superstition around Core Data. Be wary of blindly adopting advice that doesn't fix an immediate problem. (I'm including "something is slow" as an immediate problem.)

There's a wide variety of libraries and utilities around Core Data. Again, be careful about blindly adopting them if they don't solve an immediate problem.

Oh, and migrations can be a rude surprise. Do a thorough test run of a migration after a significant change to your data model. Do that before you release the first Core Data-enabled version of your app. (Maybe do this while waiting for review.) Make sure you're at least hazily comfortable with the process and you'll have no trouble at all.

lord funk
Feb 16, 2004

Okay. Reasons I have for using Core Data instead of normal archiving:

- to allow searching through user documents' tags, titles, and comments to show a filtered list of documents.
- using those searches to make 'smart' folders to group user documents.
- implementing undo / redo during document editing
- better versioning handling

Is there a decent way to implement metadata searching without Core Data? I'm talking about searching through dozens of files (not thousands or anything big).

Also I did notice that there are lots of warnings about changing the data model (i.e. - it breaks everything instantly). I was hoping that the version handling would help smooth things over, not make it more difficult.

Doctor w-rw-rw-
Jun 24, 2008
Just a couple of suggestions:
  • Don't try to use it on multiple threads.
  • Use it where needed, but otherwise use PONSOs (Plain Old NSObjects) and separate the notion of persistent models and memory models. Prefer immutable ones if you're doing a lot of multithreaded stuff, so you don't have to worry about synchronizing access.
  • If you need to use it on multiple threads, you're probably doing it wrong, but you'll have to have different contexts and sync between them. This can get expensive for large object graphs.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Doctor w-rw-rw- posted:

Just a couple of suggestions:
  • Don't try to use it on multiple threads.
  • Use it where needed, but otherwise use PONSOs (Plain Old NSObjects) and separate the notion of persistent models and memory models. Prefer immutable ones if you're doing a lot of multithreaded stuff, so you don't have to worry about synchronizing access.
  • If you need to use it on multiple threads, you're probably doing it wrong, but you'll have to have different contexts and sync between them. This can get expensive for large object graphs.

The post-iOS5 concurrent contexts work pretty well, at least compared to how it used to be. You can at least avoid a model-out-of-sync crashfest.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Those are all good reasons to adopt Core Data. I think once you get up the learning curve a bit you'll find that stuff just falls into place.

lord funk posted:

Also I did notice that there are lots of warnings about changing the data model (i.e. - it breaks everything instantly). I was hoping that the version handling would help smooth things over, not make it more difficult.

"Lightweight migration" seems to work very well. It can handle the trivial changes to your data model (like adding a new attribute to an entity).

What I'll refer to as "heavyweight migration" works just fine, but like I said, you'll want to give it a test run before shipping your app with Core Data turned on. It's an involved process with plenty of opportunity for fuckery.

Doctor w-rw-rw-
Jun 24, 2008

ultramiraculous posted:

The post-iOS5 concurrent contexts work pretty well, at least compared to how it used to be. You can at least avoid a model-out-of-sync crashfest.

They "work pretty well" at scale if you're okay with a couple of seconds of unresponsiveness when you synchronize.

Doctor w-rw-rw- fucked around with this message at 10:18 on Aug 20, 2013

Fillerbunny
Jul 25, 2002

so confused.
This feels like an appropriate time to ask, has anyone ever used ZMQ in any capacity? I'm mostly interested in using it to communicate to/from and potentially across threads, but the existing ObjC binding is being a pain in the balls, and hasn't been updated in a while.

But yeah, any success stories?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Fillerbunny posted:

This feels like an appropriate time to ask, has anyone ever used ZMQ in any capacity? I'm mostly interested in using it to communicate to/from and potentially across threads, but the existing ObjC binding is being a pain in the balls, and hasn't been updated in a while.

But yeah, any success stories?

I've used it. Don't use it.

(What are you trying to do?)

Fillerbunny
Jul 25, 2002

so confused.

pokeyman posted:

I've used it. Don't use it.

(What are you trying to do?)

At the moment? Nothing specific, I'm just testing the waters with the inproc protocol they've got set up to communicate from a thread to avoid synchronizing or any of that nonsense. We're looking at using it for a middle/service tier element for routing/brokering messages, but for now my use is experimental.

What did it do to you?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Fillerbunny posted:

At the moment? Nothing specific, I'm just testing the waters with the inproc protocol they've got set up to communicate from a thread to avoid synchronizing or any of that nonsense. We're looking at using it for a middle/service tier element for routing/brokering messages, but for now my use is experimental.

What did it do to you?

I wanted to use it for a public-facing server, but (at the time, maybe not anymore) it assert()s all over the place at the slightest indication of bad data. But maybe I wasn't using it right?

I also found the Objective-C bindings were an incredibly thin layer. I'd probably write my own.

lord funk
Feb 16, 2004

Thanks for the Core Data tips.

Doctor w-rw-rw- posted:

Just a couple of suggestions:
  • Use it where needed, but otherwise use PONSOs (Plain Old NSObjects) and separate the notion of persistent models and memory models. Prefer immutable ones if you're doing a lot of multithreaded stuff, so you don't have to worry about synchronizing access.
This sounds like a huge relief. I've already got my PONSOs done and working well, so if I understand correctly I can just use Core Data for the persistent document model and its 'tags,' but not bother with it for the actual goodies inside? That would be great.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

pokeyman posted:

I wanted to use it for a public-facing server, but (at the time, maybe not anymore) it assert()s all over the place at the slightest indication of bad data. But maybe I wasn't using it right?

I also found the Objective-C bindings were an incredibly thin layer. I'd probably write my own.
It now just drops bad messages rather than crashing, but ZeroMQ is definitely not intended for anything public-facing.

Doh004
Apr 22, 2007

Mmmmm Donuts...
Do we have a goon iOS developer irc chat? I'm fumbling about with autolayout and I have some questions that Google isn't being super obvious with.

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane

Doh004 posted:

Do we have a goon iOS developer irc chat? I'm fumbling about with autolayout and I have some questions that Google isn't being super obvious with.

I don't think we have one right now, but I certainly wouldn't mind it if one were set up.

Also, autolayout sucks. I thought Android's layout options were a pain in the rear end...

Doc Block
Apr 15, 2003
Fun Shoe
The new autolayout stuff in Xcode 5 is nice, but doing it in code still sucks donkey balls.

Doh004
Apr 22, 2007

Mmmmm Donuts...
I just got my first view controller to use autolayout, via code, and at first I completely hated it. But I'm starting to warm up to it as I just realized I don't need to override willLayoutSubviews or anything like that, which is nice.

Fillerbunny
Jul 25, 2002

so confused.

pokeyman posted:

I also found the Objective-C bindings were an incredibly thin layer. I'd probably write my own.

Yeah, I was thinking I might do that. It'd be a good exercise for me since I'm pretty new to Objective-C anyway.

Plorkyeran posted:

It now just drops bad messages rather than crashing, but ZeroMQ is definitely not intended for anything public-facing.

What's your experience with it been?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I've only used it for communicating between threads and processes on a single machine in Lua. Its API was at exactly the level of abstraction that I happened to want and I encountered no problems with it, so my experience was quite positive.

Fillerbunny
Jul 25, 2002

so confused.

Plorkyeran posted:

I've only used it for communicating between threads and processes on a single machine in Lua. Its API was at exactly the level of abstraction that I happened to want and I encountered no problems with it, so my experience was quite positive.

Ah, okay, cool. That's precisely my model in this experimental phase.

Thanks to both of you for your input, I've read the docs but am still a little lukewarm on drinking their kool-aid.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Doh004 posted:

I just got my first view controller to use autolayout, via code, and at first I completely hated it. But I'm starting to warm up to it as I just realized I don't need to override willLayoutSubviews or anything like that, which is nice.

Animation with auto layout is pretty cool. Just add a constraint and call -setNeedsLayout in an animation block and poof!

plasticbugs
Dec 13, 2006

Special Batman and Robin
My app receives push notifications that correspond to rows in my tableView. I'd like to have the correct row selected and detail view pushed programmatically when the notification is popped. My tableview is populated by Core Data objects and I've assigned the FetchedResultsController that populates my table to an instance variable in my TableViewController.

When my app launches, I'm trying to handle the selecting of the row in my TableViewController's viewDidAppear method. Unfortunately, at that point, the fetched results controller has not completed its fetch, so the fetchedObjects array is empty inside viewDidAppear. performFetch is being handled by a parent class in viewWillAppear (I'm using a boilerplate "Core Data Table View Controller" from the Stanford iTunes U class -- which is adapted from an Apple docs sample). I can tinker with that code, but I'd rather not because it scares me.

I need the Core Data entity's indexPath to select the proper row, but I can't get the indexPath until the FRC completes its fetch.

Is there a completion handler or some kind of notification I can set up so I know exactly when the fetch finishes, so I can get at the FRC's fetchedObjects?

Doctor w-rw-rw-
Jun 24, 2008
Two small nuggets of anecdotal wisdom I've picked up at Facebook this summer:

1) Don't use threads. Use Grand Central Dispatch. Seriously. There is virtually no chance you can make something anywhere near as stable/productive/performant as it for parallel procession on iOS or OS X, and make it worth it. The overhead isn't just minimal, it's loving insignificant. The time you waste on threads will give you performance that is completely negligible.
2) FRCs blow pretty hard, especially with concurrent contexts.

Given that the specific people who have told me this are arguably among the top iOS engineers in the world, I'm willing to give it the benefit of the doubt.

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

Doctor w-rw-rw- posted:

2) FRCs blow pretty hard, especially with concurrent contexts.

Can you elaborate on this one? So far FRC has been nothing but a beloved workhorse for me. I haven't used it with concurrent contexts yet though, so maybe that's where problems crop up.

Siguy
Sep 15, 2010

10.0 10.0 10.0 10.0 10.0
Is there an Objective-C equivalent for Premailer? Sending HTML emails with the CSS forced into inline-styles feels like it's a common problem that there should be a library for. What am I missing?

Doh004
Apr 22, 2007

Mmmmm Donuts...

pokeyman posted:

Animation with auto layout is pretty cool. Just add a constraint and call -setNeedsLayout in an animation block and poof!

Ooooh this could be interesting...

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

plasticbugs posted:

I need the Core Data entity's indexPath to select the proper row, but I can't get the indexPath until the FRC completes its fetch.

Is there a completion handler or some kind of notification I can set up so I know exactly when the fetch finishes, so I can get at the FRC's fetchedObjects?

NSFetchedResultsControllerDelegate's -controllerDidChangeContent:.

As for "don't use FRCs": if they work for you then use them, but they're especially persnickety. Make your own instead of trying to work around its limitations.

(FRC has a storied history of being a buggy piece of poo poo, so that could explain the poor recommendation of a veteran iOS dev.)

Doh004
Apr 22, 2007

Mmmmm Donuts...
I have a UISearchBar that I'm adding as a subview to my navigationBar. I wanted it to be a leftBarButtonItem but I need more control over the margins on the side.

Everything is working great, except for the search icon and my placeholder text. When the view gets added, everything is in the correct position except for those two items. Instead, they're offset to the right about 20 pts, and then animate to the left to be in the correct position. What's even weirder is that the cursor is in the correct position - just the icon and placeholder text is in the wrong initial spot. Any ideas?

Doctor w-rw-rw-
Jun 24, 2008

Doh004 posted:

I have a UISearchBar that I'm adding as a subview to my navigationBar. I wanted it to be a leftBarButtonItem but I need more control over the margins on the side.

Everything is working great, except for the search icon and my placeholder text. When the view gets added, everything is in the correct position except for those two items. Instead, they're offset to the right about 20 pts, and then animate to the left to be in the correct position. What's even weirder is that the cursor is in the correct position - just the icon and placeholder text is in the wrong initial spot. Any ideas?
Comedy answer (half serious, I kind of did this recently sort of): Replace UINavigationBar with something that doesn't suck balls for custom styling? :getin:

Constructive answer: Maybe play with [CATransaction setDisableActions:YES] and see if there's some implicit animations getting run? Dunno.

Random note: we use Objective-C++ for some nifty things like an Objective-C++ class to save the value of disableActions on construction then set it to yes, then restore it to its original value in its destructor. makes it pretty easy to ensure particular blocks of code never execute with implicit animations, without affecting state outside of its scope.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
I'm calling AFNetworking's enqueueBatchOfHTTPRequestOperations to download a large collection of assets from S3 and I'm noticing that on wifi frequently one of the requests out of the batch will fail. Is this to be expected, and thus should I have retry logic in place, or is this not supposed to happen and should I be looking for larger issues? To be more accurate, the error is the request timing out.

DreadCthulhu fucked around with this message at 00:58 on Aug 21, 2013

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
It's probably not what you're running in to, but S3 is not a CDN and is designed to occasionally fail to fulfill requests and require a retry.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Apparently cranking up timeout to at least 2 mins gives everything time to complete. Oh well.

Adbot
ADBOT LOVES YOU

plasticbugs
Dec 13, 2006

Special Batman and Robin

pokeyman posted:

NSFetchedResultsControllerDelegate's -controllerDidChangeContent:.

Thanks for your help. This almost works. -controllerDidChangeContent: is only called when the table populates for the first time (and when there are changes to any of the objects). So, this is working reliably only once - when the app is launched for the very first time and the database has yet to be populated.

Unfortunately, I'm back to where I started. Is there a way to do something like trigger a method only once when frc.fetchedObjects goes from being NULL to not being NULL? I'm looking into KVO, but when I try to observe the frc's fetchedObjects property, I'm not being notified when the value goes from NULL to however many objects are in my database.

Edit: I hate myself for this. I've added a lovely workaround by calling my method inside -viewDidAppear with -performSelector:withObject:afterDelay (with a 1/2 second delay). :suicide:

plasticbugs fucked around with this message at 08:08 on Aug 21, 2013

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply