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
Toady
Jan 12, 2009

Martytoof posted:

I'm actually kind of curious to hear everyone's thoughts on whether a "new" iOS programmer should learn with ARC enabled or not. Let's just say for the sake of arguing that backwards compatibility isn't an issue.

To my recollection, ARC is enabled by default for new projects. A new iOS programmer will just be learning the pure ownership semantics of strong and weak references rather than the error-prone manual management of ownership through retain/release. If the concern is that someone should be learning the concept of memory management, keep in mind that you didn't free() objects with -release anyway--all you were doing was relinquishing ownership, and the framework decided when it was time to free().

As a bonus, nobody can confuse themselves by calling -retainCount anymore.

Toady fucked around with this message at 09:45 on Nov 23, 2011

Adbot
ADBOT LOVES YOU

Strict 9
Jun 20, 2001

by Y Kant Ozma Post
This is so frustrating! Basically, I'm getting this error on my work computer, but not my home computer. Both computers are running XCode 4.2.1 using the exact same files (synched via Dropbox).

code:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: 
'[<LetsEatAppDelegate 0x5a824a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key navBar.'
Once again, this works perfectly on one machine. Not to mention, I don't even have a navBar (or mention of one) anywhere in the project.

What gives? I posted more details over at Stack Overflow

Funso Banjo
Dec 22, 2003

Anyone have their paydate on Connect yet?

Seems a little late. It's my first big payment, so I am a little nervous. It says how much I can expect, like always. Just no date on there yet. I figure it was a 5 week month last month, perhaps that's why.

Can't help but think it's normally just a few thousand dollars, though, and this time it's a lot more, and maybe they're trying to find a way not to pay me so much. Paranoia, I am sure.

Carthag Tuek
Oct 15, 2005

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



Strict 9 posted:

This is so frustrating! Basically, I'm getting this error on my work computer, but not my home computer. Both computers are running XCode 4.2.1 using the exact same files (synched via Dropbox).

code:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: 
'[<LetsEatAppDelegate 0x5a824a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key navBar.'
Once again, this works perfectly on one machine. Not to mention, I don't even have a navBar (or mention of one) anywhere in the project.

What gives? I posted more details over at Stack Overflow

Try looking in your xib files in a text editor (they're basically XML) and search for "navBar". Maybe you can find something in there. Actually, try looking through all files in your project:

grep -R "navBar" /path/to/project

OHIO
Aug 15, 2005

touchin' algebra

Funso Banjo posted:

Anyone have their paydate on Connect yet?

Seems a little late. It's my first big payment, so I am a little nervous. It says how much I can expect, like always. Just no date on there yet. I figure it was a 5 week month last month, perhaps that's why.

Can't help but think it's normally just a few thousand dollars, though, and this time it's a lot more, and maybe they're trying to find a way not to pay me so much. Paranoia, I am sure.

I don't have a date yet either but I'm not worried. Did you get featured? Congrats!

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Strict 9 posted:

This is so frustrating! Basically, I'm getting this error on my work computer, but not my home computer. Both computers are running XCode 4.2.1 using the exact same files (synched via Dropbox).

code:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: 
'[<LetsEatAppDelegate 0x5a824a0> setValue:forUndefinedKey:]: 
  this class is not key value coding-compliant for the key navBar.'
Once again, this works perfectly on one machine. Not to mention, I don't even have a navBar (or mention of one) anywhere in the project.

What gives? I posted more details over at Stack Overflow

Clear out your derived data folder. ~/Library/Developer/Xcode/DerivedData. I'm guessing you have an old compiled xib file that isn't getting recompiled and it still has a navBar reference.

some kinda jackal
Feb 25, 2003

 
 
This is going to be a really dumb question, but what's the deal with having to declare methods in order? Like if I create method one, and in method one I make a call to method two, but method two is physically located below method one in the source, Xcode will throw an error saying that method two isn't declared.

I thought the compiler would be smart enough to parse the entire source for a declaration. This is something I'd expect from BASIC. Like I said, I'm sure this is babby's first question, but it seems weird for a compiler that smart to be tripped up by something like that, especially since it bulletproofs every other little thing I do.

Toady
Jan 12, 2009

Martytoof posted:

This is going to be a really dumb question, but what's the deal with having to declare methods in order? Like if I create method one, and in method one I make a call to method two, but method two is physically located below method one in the source, Xcode will throw an error saying that method two isn't declared.

I thought the compiler would be smart enough to parse the entire source for a declaration. This is something I'd expect from BASIC. Like I said, I'm sure this is babby's first question, but it seems weird for a compiler that smart to be tripped up by something like that, especially since it bulletproofs every other little thing I do.

That's C for you. Declare the methods in a header or class extension, and you can place the method definitions in any order you like.

some kinda jackal
Feb 25, 2003

 
 
Yeah, I when I used to "know" this stuff I remember placing most of my methods into the header file whether they were intended to be public or private, which I guess was probably a poor design decision. That's probably why I don't remember running into this problem. By class extension you mean the private interface declaration that I can add to the beginning of my .m?

Kekekela
Oct 28, 2004

Martytoof posted:

By class extension you mean the private interface declaration that I can add to the beginning of my .m?
Yep.

Toady
Jan 12, 2009

Martytoof posted:

Yeah, I when I used to "know" this stuff I remember placing most of my methods into the header file whether they were intended to be public or private, which I guess was probably a poor design decision. That's probably why I don't remember running into this problem. By class extension you mean the private interface declaration that I can add to the beginning of my .m?

Yes, declared like a category without a name: Class extensions explained

Strict 9
Jun 20, 2001

by Y Kant Ozma Post

Carthag posted:

Try looking in your xib files in a text editor (they're basically XML) and search for "navBar". Maybe you can find something in there. Actually, try looking through all files in your project:

grep -R "navBar" /path/to/project

No luck there unfortunately. This project was created from a new Window based project template, and I definitely never added a navBar, which is part of why this is so confusing.

pokeyman posted:

Clear out your derived data folder. ~/Library/Developer/Xcode/DerivedData. I'm guessing you have an old compiled xib file that isn't getting recompiled and it still has a navBar reference.

Ugh, that sounded like the perfect explanation - still no go though.

some kinda jackal
Feb 25, 2003

 
 
Thanks for that link. I feel stupid asking such a dumb question but now I'm smarter for it so everyone wins :cool:

e: Also what's tripping me up is that dragging a target from storyboard to code doesn't declare it in the interface anymore. How does that work? I would have thought that would NEED to be a public method :psyduck:

Looks like I have a LOT of reading to do. The more I find out the more I realize how little I understand.

some kinda jackal fucked around with this message at 18:14 on Nov 23, 2011

Sewer Adventure
Aug 25, 2004

Toady posted:

FYI: Before you speak so authoritatively on Apple's thought process, you should be aware that you're arguing with someone who works on language implementation.

Thanks I didn't realise that appeal to authority was a valid argument

Strict 9
Jun 20, 2001

by Y Kant Ozma Post
To follow up on my issue, if I create a brand new Window-based application, I can build and run it fine.

If I create a brand new Window-based application and name it with the same name as the one I'm having trouble with (even in a completely different location), I get the same navBar error. Even after clearing out the DerivedData folder.

:what:

AHA!. I got it. Had to go to iOS Simulator > Reset Content and Setting. Thanks for pointing me in the direction of reseting though.

Strict 9 fucked around with this message at 18:25 on Nov 23, 2011

Toady
Jan 12, 2009

Sewer Adventure posted:

Thanks I didn't realise that appeal to authority was a valid argument

It is, actually, when the authority is legitimate and has firsthand knowledge. Additionally, clang, libauto, and several other Apple initiated projects are in C++ or incorporate it in some way (iPhoto uses Objective-C++ according to class-dump). Objective-C is not the be-all, end-all of Apple platform development.

Too often, people view an engineering data point as a judgement on something. It's nothing more than a stated fact that may or may not be relevant for your particular project. NSArray (and Objective-C in general) is objectively less efficient, but that doesn't mean you shouldn't use it, because productivity/flexibility may be a more important factor than performance, and it usually is.

Martytoof posted:

e: Also what's tripping me up is that dragging a target from storyboard to code doesn't declare it in the interface anymore. How does that work? I would have thought that would NEED to be a public method :psyduck:

I've barely played with storyboards, but if you're referring to target-action, "IBAction" is a design-time feature to let Interface Builder know which methods are actions. It has access to all your source code and doesn't need to follow the visibility rules of a compiler.

Toady fucked around with this message at 19:04 on Nov 23, 2011

some kinda jackal
Feb 25, 2003

 
 

Toady posted:

I've barely played with storyboards, but if you're referring to target-action, "IBAction" is a design-time feature to let Interface Builder know which methods are actions. It has access to all your source code and doesn't need to follow the visibility rules of a compiler.

Well, sort of. I'm surprised that a method which isn't declared in the public interface can be used as a target for an IBAction because in my understanding it's all done through performSelector: in the end anyway, isn't it? If that's the case wouldn't the selector need to be public?

Obviously not because that's not how it happens today, but just one of the many things I have backwards in my head for one reason or another.

I'm starting to figure this out, and I have something like two Apple docs on my to-do list which will probably explain exactly why I'm wrong. Part of me wonders how much easier this would be if I never learned this back in the day. Now I'm coming into it with bits and pieces of old information and it's tripping me up a little.

Though seeing an app pop from Xcode to my iPad is loving swell and makes the trouble completely worthwhile :3:

e: I should add that dragging a target action from my storyboard IB to my INTERFACE file actually does what I was expecting, creates the public method declaration AND the corresponding method implementation. I'm just surprised that dragging a target action directly into my implementation doesn't do the same.

some kinda jackal fucked around with this message at 19:23 on Nov 23, 2011

Toady
Jan 12, 2009

Martytoof posted:

Well, sort of. I'm surprised that a method which isn't declared in the public interface can be used as a target for an IBAction because in my understanding it's all done through performSelector: in the end anyway, isn't it? If that's the case wouldn't the selector need to be public?

No, because Objective-C uses runtime lookup, so it can call any selector on an object regardless of whether or not a method for it was publicly declared at compile-time. Method calls are translated by the compiler into function calls to the Objective-C runtime, with the selector passed as an argument. That the compiler warns you about calling undeclared methods at compile-time is a sanity feature.

Kekekela
Oct 28, 2004

Martytoof posted:

Well, sort of. I'm surprised that a method which isn't declared in the public interface can be used as a target for an IBAction because in my understanding it's all done through performSelector: in the end anyway, isn't it? If that's the case wouldn't the selector need to be public?
I think public/private as it pertains to methods (with public referring to something in the .h file) is just a cosmetic thing. There's nothing preventing other code from calling your "private" method or having them invoked via performSelector.

ptier
Jul 2, 2007

Back off man, I'm a scientist.
Pillbug

Martytoof posted:



e: I should add that dragging a target action from my storyboard IB to my INTERFACE file actually does what I was expecting, creates the public method declaration AND the corresponding method implementation. I'm just surprised that dragging a target action directly into my implementation doesn't do the same.

My guess would be that since the actions are first declared in the .h and then the method implements it, the assumption would be to always drag it into the .h first ( one way only of doing it ) to get all the fun framework stuff. That or they only thought of doing it one way and in testing it will change later as they see people using it.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Strict 9 posted:

AHA!. I got it. Had to go to iOS Simulator > Reset Content and Setting. Thanks for pointing me in the direction of reseting though.

poo poo, sorry, I should've mentioned that part too. I've had exactly what you describe happen to me before with Mac apps, but not with an iOS app, and I didn't map that in my head.

Switzerland
Feb 18, 2005
Do what thou must do.
This is quite likely a dumb question, so sorry in advance if it is: If an iPhone or iPad game uses on-screen controls in a d-pad configuration (up down left right) and some action buttons, do the devs have to pay royalties to Nintendo/Sega/Whoever has that patent? Or is that somehow handled in the iOS dev agreement with Apple?

ptier
Jul 2, 2007

Back off man, I'm a scientist.
Pillbug
I took a look through the OP and I didn't see this so I'll ask.

I was looking at the 2 kinds of pay dev accounts where one is a personal and one is signing up as a business. At the moment I don't want to make a company with the state and fed just to play with what I am building until I am ready to start rolling in that direction. Is it difficult to transfer ownership of apps in the app store between two accounts if I need to change from personal to corp later? I know I'll have to make a new account when I want to be a business but what can I do with the apps I already have under the personal account?

Also this thread is a awesome and I'm learning a lot. Thanks everyone for your explanations to other people's questions.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Nope, it's not hard, I don't think it's automated though so you'll have to get in touch with someone at Apple when you want to make the switch. Happens all the time.

Toady
Jan 12, 2009

Martytoof posted:

e: I should add that dragging a target action from my storyboard IB to my INTERFACE file actually does what I was expecting, creates the public method declaration AND the corresponding method implementation. I'm just surprised that dragging a target action directly into my implementation doesn't do the same.

Presumably, Xcode is just assuming the developer's intention is to not declare the method publicly in the interface. I don't declare IBActions in my headers either, though I do in a class extension.

Toady fucked around with this message at 23:44 on Nov 24, 2011

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Really the only reason to make IBActions public would be for other objects to call your "IBAction" programmatically. Which is arguably in poor taste, but there's nothing stopping you.

Interface Builder used to only parse header files right? That's why everyone puts IBActions in headers?

PT6A
Jan 5, 2006

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

pokeyman posted:

Really the only reason to make IBActions public would be for other objects to call your "IBAction" programmatically. Which is arguably in poor taste, but there's nothing stopping you.

Interface Builder used to only parse header files right? That's why everyone puts IBActions in headers?

I can't speak for others, but that's why I do it.

Is it considered bad practice to not declare private methods anywhere? I do it from time to time, but it obviously results in warnings. Likewise with not casting my app delegate. It works, but I have the nagging feeling that I should stop being a lazy rear end in a top hat about it.

Switzerland
Feb 18, 2005
Do what thou must do.
Nobody got an answer for my d-pad question? :(

Kekekela
Oct 28, 2004
In X-Code, If I've got a split view with my storyboard showing in the left panel and a code window in the right panel, it seems that every time I ctrl+drag to set up outlets or target actions, it resets the left panel to a blank storyboard window and I've got to scroll pages to get back to the story board that actually is displaying the view I'm working with..any idea how to correct this?

e: actually it seems to just go to a blank storyboard window semi-randomally at various points (like if I run then quit the simulator, drag an action, etc) and I close and reopen the storyboard window to get my view displayed again.


Never mind, I think I had an extra storyboard window that it kept flipping to or something...still getting the hang of Mac OS

Kekekela fucked around with this message at 16:39 on Nov 25, 2011

kitten smoothie
Dec 29, 2001

ptier posted:

I took a look through the OP and I didn't see this so I'll ask.

I was looking at the 2 kinds of pay dev accounts where one is a personal and one is signing up as a business. At the moment I don't want to make a company with the state and fed just to play with what I am building until I am ready to start rolling in that direction. Is it difficult to transfer ownership of apps in the app store between two accounts if I need to change from personal to corp later? I know I'll have to make a new account when I want to be a business but what can I do with the apps I already have under the personal account?

Also this thread is a awesome and I'm learning a lot. Thanks everyone for your explanations to other people's questions.

You don't need to make a new account, you just call up Apple and say "hey I want to change my personal account to a business account." Then they walk you through the process which takes about a week to ten days, and requires you to fax them your incorporation documents from the state. It costs nothing to go through the transition and the people who answer the phones there are super friendly and informative about what is going on.

Your iTunes Connect and provisioning portal accounts will be locked out during the transition process. Any apps you have for sale will stay for sale during the lockout period, but stuff that's presently in review when you start the transition will get thrown out.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

PT6A posted:

I can't speak for others, but that's why I do it.

Is it considered bad practice to not declare private methods anywhere? I do it from time to time, but it obviously results in warnings. Likewise with not casting my app delegate. It works, but I have the nagging feeling that I should stop being a lazy rear end in a top hat about it.

I'd say warnings are bad practice (I tend to toggle a couple from the defaults and then turn on -Werr), but as for pointlessly copying a method signature nobody else ever sees? By all means don't bother.

Though if you tend to document your methods where they're declared, as opposed to implemented, that might be a reason to declare private methods in a class extension.

As for your app delegate, here's a lazy person's handy trick:

code:
@implementation MyAppDelegate

static MyAppDelegate *instance;

+ (MyAppDelegate *)instance
{
    return instance;
}

- (void)applicationDidFinishLaunchingWithOptions:(NSDictionary *)options
{
    instance = self;
}

@end
And publicly declare +instance of course. You can even pop your MyAppDelegate.h into your .pch and then you can just [MyAppDelegate instance].whatever whenever you like.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Switzerland posted:

Nobody got an answer for my d-pad question? :(

Your options as I see them are to ask a lawyer or do it anyway and throw in the towel if you get sued. I vote the latter.

Toady
Jan 12, 2009

pokeyman posted:

Interface Builder used to only parse header files right? That's why everyone puts IBActions in headers?

I don't remember if it parsed .m files or not, perhaps by dragging them over from Xcode.

PT6A
Jan 5, 2006

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

pokeyman posted:

As for your app delegate, here's a lazy person's handy trick:

code:
@implementation MyAppDelegate

static MyAppDelegate *instance;

+ (MyAppDelegate *)instance
{
    return instance;
}

- (void)applicationDidFinishLaunchingWithOptions:(NSDictionary *)options
{
    instance = self;
}

@end
And publicly declare +instance of course. You can even pop your MyAppDelegate.h into your .pch and then you can just [MyAppDelegate instance].whatever whenever you like.

Holy poo poo, that's excellent! Thanks.

Small White Dragon
Nov 23, 2007

No relation.
Any suggestions on good ARC tutorials for those who've been at this for a while?

Also - anybody have any QA firms they can recommend?

Funso Banjo
Dec 22, 2003

Funso Banjo posted:

Anyone have their paydate on Connect yet?

Seems a little late. It's my first big payment, so I am a little nervous. It says how much I can expect, like always. Just no date on there yet. I figure it was a 5 week month last month, perhaps that's why.

Can't help but think it's normally just a few thousand dollars, though, and this time it's a lot more, and maybe they're trying to find a way not to pay me so much. Paranoia, I am sure.

Last month's payday was 27th of October. And I was informed of the date around the 18th of October.

I am seriously a little worried that it's the 27th of November and I don't even have a designated pay date yet.

Christmas is coming up, and I think my wife will kill me if I don't get paid fairly soon.

You guys still don't have paydate information, too?

kitten smoothie
Dec 29, 2001

No payment date here for the whopping $48.80 I am owed this cycle (on the upside it's 26 cents more than last month, I'm on the up and up here!).

eeenmachine
Feb 2, 2004

BUY MORE CRABS

kitten smoothie posted:

No payment date here for the whopping $48.80 I am owed this cycle (on the upside it's 26 cents more than last month, I'm on the up and up here!).

Don't they hold payment until you're owed more than $250 in a territory or did they get rid of that?

Funso Banjo
Dec 22, 2003

eeenmachine posted:

Don't they hold payment until you're owed more than $250 in a territory or did they get rid of that?

They got rid of that. Thank god, or my early months would have been even drier than they actually were :)

It was a retarded way to do things.

Adbot
ADBOT LOVES YOU

eeenmachine
Feb 2, 2004

BUY MORE CRABS

Funso Banjo posted:

They got rid of that. Thank god, or my early months would have been even drier than they actually were :)

It was a retarded way to do things.

It made sense back when they sent a wire from every territory separately. You'd lose half your payment in bank fees.

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