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
Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



In XCode, is there a neat way to make a target only run if you have updated certain files since the last build? For example, I have a documentation target that builds an appledoc set. Currently, I re-run this target manually once in a while, but I'd like to add it to my main target. It is obviously only necessary to run it if the headers containing docs have changed. Can I somehow add a dependency like that?

Adbot
ADBOT LOVES YOU

Kallikrates
Jul 7, 2002
Pro Lurker

zergstain posted:

I don't know what could've changed, but I'm trying to observe the selectionIndex key of an NSArraryController, and it's stopped working. The change dictionary new key object is always NSNull, and when I print the value for the key path in the debugger console, I get 0xc7. The key is NSUInteger, but I thought scalars got wrapped inside an NSNumber. That is neither a valid object address, nor a valid integer selection index. Any ideas for things to try?

Thought this was something I had seen in the past, but that was observing insertions and removals.

You are probably experiencing this 'bug'
http://www.cocoabuilder.com/archive/cocoa/231886-problem-observing-selectionindex-of-an-array-controller.html
http://www.cocoabuilder.com/archive/cocoa/215277-nsarraycontroller-selectedindexes.html

You're going to have to query the ArrayController for the index.

zergstain
Dec 15, 2005

Kallikrates posted:

Thought this was something I had seen in the past, but that was observing insertions and removals.

You are probably experiencing this 'bug'
http://www.cocoabuilder.com/archive/cocoa/231886-problem-observing-selectionindex-of-an-array-controller.html
http://www.cocoabuilder.com/archive/cocoa/215277-nsarraycontroller-selectedindexes.html

You're going to have to query the ArrayController for the index.

Thanks. Don't imagine you can tell me why it was working for me before I changed something around. That 0xc7 turns out to be correct. The actual value is in the 2nd byte and up.

bc87
Dec 11, 2010
Apple is all about taking your $$$, or else you can't develop properly for their platforms.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

zergstain posted:

That 0xc7 turns out to be correct. The actual value is in the 2nd byte and up.

They're called tagged pointers.

Seriously people, read Mike Ash's blog. Cover to cover. Now do it again.

tarepanda
Mar 26, 2011

Living the Dream
This has nothing to do with programming, but are there any decent books on designing for iOS? Not necessarily the things covered in Apple's guidelines, but graphics-oriented stuff, like how to make decent icons/frames/buttons/etc. that look decent when used alongside Apple's graphics.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.

pokeyman posted:

They're called tagged pointers.

Seriously people, read Mike Ash's blog. Cover to cover. Now do it again.
My brain just exploded. I always suspected that some performance witchcraft was taking place under NSNumber and NSDate, but I had no idea that tagged pointers were a thing.

It reminds me of when I first read how CFArrays use different implementations on their own.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



What in the name

code:
(lldb) po [objectClass superclass]
(id) $1 = 0x0000000101f82cc8 GCEntity
(lldb) po [GCEntity class]
(id) $2 = 0x0000000101f82cc8 GCEntity
(lldb) p (BOOL)((Class)[objectClass superclass] == (Class)[GCEntity class])
(BOOL) $3 = YES
(lldb) p (BOOL)[objectClass isKindOfClass:(Class)[GCEntity class]]
(BOOL) $4 = NO
:psyboom:

Edit: Apparently, isKindOfClass is strict equality when called on a class (but on an instance it checks superclasses). I needed isSubclassOfClass:

That's kindof dumb.

Carthag Tuek fucked around with this message at 12:19 on Sep 7, 2012

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Carthag posted:

Edit: Apparently, isKindOfClass is strict equality when called on a class (but on an instance it checks superclasses). I needed isSubclassOfClass:

That's kindof dumb.

It's not strict equality. The GCEntity class object is not a kind of GCEntity; for example, it does not have the fields and methods associated with an instance of that class. It's a kind of GCEntity's metaclass.

Doctor w-rw-rw-
Jun 24, 2008

Carthag posted:

What in the name

code:
(lldb) po [objectClass superclass]
(id) $1 = 0x0000000101f82cc8 GCEntity
(lldb) po [GCEntity class]
(id) $2 = 0x0000000101f82cc8 GCEntity
(lldb) p (BOOL)((Class)[objectClass superclass] == (Class)[GCEntity class])
(BOOL) $3 = YES
(lldb) p (BOOL)[objectClass isKindOfClass:(Class)[GCEntity class]]
(BOOL) $4 = NO
:psyboom:

Edit: Apparently, isKindOfClass is strict equality when called on a class (but on an instance it checks superclasses). I needed isSubclassOfClass:

That's kindof dumb.

Do you *really* need it? Is respondsToSelector: not sufficient? Composition is generally preferable to inheritance, except in certain cases (such as UI)

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

Doc Block posted:

I do hit Escape and let Xcode autocomplete a method if there are a lot of parameters, or if I'm unsure of the exact method name, though.

Thanks for this. I figured there must be a way to invoke the autocomplete, but never bothered to look it up. I've been hammering esc since your post.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



rjmccall posted:

It's not strict equality. The GCEntity class object is not a kind of GCEntity; for example, it does not have the fields and methods associated with an instance of that class. It's a kind of GCEntity's metaclass.

Ah thanks that makes sense!

Doctor w-rw-rw- posted:

Do you *really* need it? Is respondsToSelector: not sufficient? Composition is generally preferable to inheritance, except in certain cases (such as UI)

Yeah in this case I can't use duck-typing. I'm iterating over an array and putting the objects into different buckets depending on their class:

https://github.com/mikkelee/Gedcom-Framework/blob/master/Gedcom/GCFile.m#L94

Doc Block
Apr 15, 2003
Fun Shoe
What do you guys do about TestFlight with regards to App Store distribution? It looks really helpful for testing, except I don't want to do a zillion #ifdefs to keep all the checkpoint reporting and whatnot out of the App Store build.

Or do I even need to worry about that?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I'd wrap the checkpoint stuff in a little function or macro that compiles itself out in the app store build, so it doesn't leave clutter. Just Checkpoint(@"charlie"), and implement Checkpoint wrapped in #ifndef APP_STORE or something.

Small White Dragon
Nov 23, 2007

No relation.
Has anyone had issues with MPVolumeView not showing up at all? (Seems to occur on both simulator and device!)

Doc Block
Apr 15, 2003
Fun Shoe

pokeyman posted:

I'd wrap the checkpoint stuff in a little function or macro that compiles itself out in the app store build, so it doesn't leave clutter. Just Checkpoint(@"charlie"), and implement Checkpoint wrapped in #ifndef APP_STORE or something.

I can't believe I didn't think of this. Thanks.

EatDirt
Nov 13, 2009
Hello, I believe I posted in this thread before asking a question to help me along when I was half into the idea of learning to make apps. I gave up after very long because of time issues. Well now I have a lot of free time on my hands and would like to really push myself into getting into the material, and actually learning how to write some apps.

I cannot at the moment afford to take classes so I figure I'll try and teach myself, doesn't sound like an impossible task, I have friends that have done it before. Some insight on learning materials and direction would be greatly appreciated.

So currently I have two books I am using:


Objective-C for Absolute Beginners: iPhone, iPad and Mac Programming Made Easy
This is the first book I have started moving through. It seems to be less centered on programming in Xcode than it is in teaching you how to make a baseline app model in a program called Alice, then tying it into Xcode for polishing; if the beginning is anything to go by.

Programming in Objective-C 5th Edition
Also this one, it looks to be just straight up Xcode programming and basic app building.

I was also watching the Stanford lessons on it, however they started in the middle of the semester I think and was kinda skewed, maybe I was missing something. Not sure if I'll continue watching them.

So any input or direction from you guys about if my poo poo looks in order would be awesome. Tell me if I am on the right track, if my post looks retarded and is in the wrong place, or if I should fork up for classes.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Any tips or pointers for where to look for a decent crash course in iOS programming without using Interface Builder or Storyboards? I'm a semi-experienced iOS dev but until now I've mostly worked on networking code and server side integration, I haven't really had much exposure to views. Team turnover has forced me into a position where I really need a better handle on higher level concerns. The other team members avoid using IB/Storyboards completely, so I'm kind of lost as to where to look for things.

Doc Block
Apr 15, 2003
Fun Shoe
Read Apple's View Controller Programming Guide.

Beyond that, read Apple's docs on stuff like UIView and whatnot.

Maybe try making a little test app that has a view hierarchy created in Interface Builder, then try to recreate it programatically.

Also, tell your coworkers to stop fighting their tools and use Interface Builder.

Doc Block fucked around with this message at 23:13 on Sep 9, 2012

zergstain
Dec 15, 2005

pokeyman posted:

They're called tagged pointers.

Seriously people, read Mike Ash's blog. Cover to cover. Now do it again.

That says the tag is in the lower 4 bits, but from what I was seeing, it takes up all 8. i.e. 0 was 0x00c7 and 1 was 0x01c7.

Is there a way to get the upper left corner of a context menu? Or what is the best way to detect where the user right-clicked initially when a menu command is selected?

Edit: This plan would fail when the click is too close to the screen edge and the menu opens with the upper right corner at the cursor instead. So maybe a way to determine where the menu initially opened. I could store the event, but I'm just checking in case there's something in the API I missed.

zergstain fucked around with this message at 15:06 on Sep 10, 2012

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

the talent deficit posted:

Any tips or pointers for where to look for a decent crash course in iOS programming without using Interface Builder or Storyboards? I'm a semi-experienced iOS dev but until now I've mostly worked on networking code and server side integration, I haven't really had much exposure to views. Team turnover has forced me into a position where I really need a better handle on higher level concerns. The other team members avoid using IB/Storyboards completely, so I'm kind of lost as to where to look for things.

The Stanford iOS cours videos (the 2011 ones w/ ARC and Storyboards) were very helpful to me in learning Storyboards.

tarepanda
Mar 26, 2011

Living the Dream
Have album creation permissions changed or do they vary from iPhone to iPad?

I tried to use this (http://www.touch-code-magazine.com/ios5-saving-photos-in-custom-photo-album-category-for-download/) to save photos to a custom album and it's not doing jack squat, even in the demo he provides.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

EatDirt posted:

So any input or direction from you guys about if my poo poo looks in order would be awesome. Tell me if I am on the right track, if my post looks retarded and is in the wrong place, or if I should fork up for classes.

You're in the right place.

Your post sounds like you want to learn "how to make apps" with no idea about what apps to make or why you should make them. This leads to hours of glazed-over reading and watching of educational material that grants a general sense of accomplishment but when you're honest you can see that you have nothing to show for your time.

Presumably you're interested in this to make something. What? What problem that you have right now is fixable by an app? Doesn't matter if you're not the first person to notice the problem. You have one, let's solve it.

Come up with something that will keep you interested. Remember that "I don't know how to do it" describes the entirety of making apps for you at this point, and reject it as an argument against pursuing a particular project. Everything is hard for you right now.

Come back when you get stuck and I'd love to help.

EatDirt
Nov 13, 2009
To clarify, I have many app ideas formulated, however, I'm hoping to get recommendations on the best way to learn how to make working models. All professionals have favorite and preferred source materials, I am just asking for your opinions and directions.

Doc Block
Apr 15, 2003
Fun Shoe
Have you ever programmed before?

I'd skip any books that try to start you off learning some "beginner" language and then segue into Objective-C. Hell, learn plain ol' C first.

Start off with a few simple command-line programs. Yes, I said command-line programs. Your early programs will only be a few files anyway, and having to invoke the compiler yourself will clarify the separate compilation model that C/C++/Objective-C use. And it'll be useful to know what Xcode is doing when you tell it to compile an app.

Plus, that'll help you focus on the basics, like understanding pointers, memory management, program structure, etc., instead of worrying about UIViews and and trying to learn the ins-and-outs of Xcode. And you'll be learning in the language you'll actually use to write apps (or, if you decide to learn C first, a subset of it).

Don't get ahead of yourself. I had a lot of false starts when learning to program because I was trying to leap into the advanced stuff before I understood the basics. Even John Carmack suffers through all the My First Program/"Hello, world!" type of programs when learning a new language.

If you've never programmed before, understand that you won't be writing big apps by the end of the week, and that's OK. You'll get frustrated at times, and that's OK too.

edit: if you already know how to program, especially if you already know C or C++, learning Objective-C is way easier, and picking up a recent iOS programming book might be enough.

Doc Block fucked around with this message at 20:55 on Sep 10, 2012

tarepanda
Mar 26, 2011

Living the Dream
iOS Programming from Big Nerd Ranch is how I got started. I was pretty much in the dark until chapter 3 or 4 though, but got more confident after sticking with it.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
After trying to help several folks (including one with a CS degree) learn how to actually write software and failing at it, I came to the same realization as pokeyman. The best way to get into programming is to come up with an app idea or task then set about implementing that idea. Feel free to copy and paste, use example code, etc. Just focus on your goal.

Don't worry about "what's best" and all that. Every line of code your write in the beginning will be absolute garbage. All your design decisions will be horrible and wrong. That's fine and it's part of learning the craft.

I would also recommend the idea be a real one, not some fake "I'll make a DVD library app to help me keep track of my DVDs :haw: ". You can always refactor, rewrite, or start over once you get more experience but even the ugliest code is 10x better than all the wishes in the world.

Doc Block
Apr 15, 2003
Fun Shoe
I'm not so sure, I had a lot of "Well to hell with this" moments when I taught myself to program because of things like trying to write a big app without understanding pointers.

Once you get the basics down though, yeah, it really really helps to have a goal and set about implementing it. And yeah, it'll be crap, but it'll be your crap, and getting your first Real Program working is a great feeling.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
True, I wouldn't recommend tackling a huge app to start with... I just mean avoid the obviously simplistic hello world kind of stuff because you'll get bored of those quickly and it will feel like wasted effort. You could do something like an app that lets you associate a picture with a song so when you play certain songs it will show certain pictures. Maybe that's a bad example but it's real world enough not to feel like a huge waste of time.

tarepanda
Mar 26, 2011

Living the Dream
I'm getting an array of thumbs and dates from a specific album by using ALAssetsLibrary enumerateGroupsWithTypes:usingBlock, and then in the block, using [ALAssetsGroup enumerateAssetsAtIndexes:options:usingBlock. It's working wonderfully except for one thing -- it seems to be asynchronous?

I want to call it in viewDidLoad so that I can initialize those two arrays for use with a UIScrollView; it wasn't working and after some judiciously-placed NSLogs, I realized that even though the method calls were in the order init arrays -> search album to populate arrays -> init scroll view, what it was actually doing was init arrays -> init scroll view -> search album to populate arrays.

Is this something specific to ALAssetsLibrary objects, or something that has to do with using blocks or enumeration in Objective-C?

And more to the point, how do I fix this?

Doc Block
Apr 15, 2003
Fun Shoe
Blocks don't have to be asynchronous (they execute as soon as they're called, on whatever thread they're called from), but a common use for them is completion blocks for asynchronous operations because you can just pass in a block to be executed when the operation is done instead of having to go with the delegate model.

In this particular case it sounds like a good idea, since you don't want potentially time-consuming stuff happening synchronously; a user with a lot of pictures in their library won't appreciate it if your app's UI freezes while the library loads.

As to fixing it, why can't you add them to your UIScrollView as you go along?

edit: the docs for ALAssetsLibrary specifically state that this method is asynchronous. It's because of the requirement that the user grant access to location services (images could have GPS data embedded); the method needs to return immediately to free up the main thread so that ALAssetsLibrary can present an alert view to ask for permission to access location services.

Doc Block fucked around with this message at 02:50 on Sep 11, 2012

tarepanda
Mar 26, 2011

Living the Dream
In this particular case, I need the enumeration to finish so that I know how many photos are in the album before I set the UIScrollView's contentSize.

Doc Block
Apr 15, 2003
Fun Shoe
You know that you can dynamically adjust the scroll view's content size, right? In each enumeration block, fire off another block to the main thread with dispatch_async() that increases the content size of the scroll view and adds the image thumbnails to it or whatever.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
Why not start with one or a loading image then use CoreAnimation to have it dynamically size when more get added in? Then you look like a smooth app being all fancy n' poo poo. :q:

Edit: Beaten by the doc, like an ugly step-child.

Sometimes I find that the API naturally leads you to make a better designs. I'm sure that's why a ton of stuff doesn't even have synchronous methods. Might as well force developers to deal with it.

tarepanda
Mar 26, 2011

Living the Dream
I didn't know and ended up realizing that after I looked up some more things, so that's what I'm doing now. Oops.

Neeext question, is there any way to define a custom AVCaptureSessionPreset? It seems really retarded that the only 4:3 options are AVCaptureSessionPreset640x480 and AVCaptureSessionPhoto when the latter is 2048 x 1536.

No 1024 x 768? How about 1280 x 1024? 1600 x 1200?

Fate Accomplice
Nov 30, 2006




Do any of you guys have experience with Parse.com ? I have a question about it:

I have two tables, Users, and Messages. Users are PFUsers, Messages have "to" and "from" keys, each of which contains a PFUser as value.

I have a UITableView whose rows are populated by the rows of the Users table. I want to sort this before displaying by the descending time of the last Message's creation received from that user.

AKA I have a PFQuery on Users. order that query by the createdAt field of the Messages table, constrained on User == Messages-from.

Any ideas on how to construct the query?

Doc Block
Apr 15, 2003
Fun Shoe

tarepanda posted:

I didn't know and ended up realizing that after I looked up some more things, so that's what I'm doing now. Oops.

Neeext question, is there any way to define a custom AVCaptureSessionPreset? It seems really retarded that the only 4:3 options are AVCaptureSessionPreset640x480 and AVCaptureSessionPhoto when the latter is 2048 x 1536.

No 1024 x 768? How about 1280 x 1024? 1600 x 1200?

No, because it's hardware dependent. The images you're getting have to go through some filtering first (such as a de-Bayer filter), which is almost certainly done in hardware. The image processing hardware probably only has so many presets available in order to keep complexity down (thereby keeping transistor count, power consumption, heat output, and cost down also).

Also, AVCaptureSessionPresetPhoto will give you the maximum size that the camera supports, which is going to be a lot bigger than 2048x1536 on anything later than an iPhone 3GS.

What are you trying to do?

Doc Block fucked around with this message at 03:53 on Sep 11, 2012

tarepanda
Mar 26, 2011

Living the Dream
I'm using an AVCaptureSession and performing some pretty complex real-time analysis on the feed; at 640 x 480, it's too lovely to save as a photo; at Photo, it's 2048 x 1536 and way too much data, which results in a lot of lag. What I really need is a happy medium like 1024 x 768 or something.

I've tried changing resolutions mid-session before taking photos, but that's not really an optimal solution since the change isn't instantaneous (about three or four frames pass) and there are lag/quality issues as it tries to rebalance/refocus with the new mode.

Doc Block
Apr 15, 2003
Fun Shoe
Maybe lock the focus, exposure, and white balance while the switch happens?

How are you taking the photos? On my iPhone 4, with AVCaptureSessionPresetPhoto, the real-time video output feed is something like 858x640, and you only get the full 2048x19whatever image when you try to capture from the still image output.

Is there a reason it needs to be 4:3? Can you just crop the output of one of the video modes?

Doc Block fucked around with this message at 03:54 on Sep 11, 2012

Adbot
ADBOT LOVES YOU

tarepanda
Mar 26, 2011

Living the Dream
4:3 is the only aspect ratio that will give me the full camera view; the video modes give you a much tighter portion of the full camera view. I need as wide a view as possible.

Since I'm doing frame-by-frame analysis, I'm converting the frames to UIImages and saving those to the gallery.

Edit: The worst of the lag is really incurred by switching presets -- it locks up the video feed as it switches, which really screws up the user experience and looks crappy.

tarepanda fucked around with this message at 04:04 on Sep 11, 2012

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