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
y_y
Oct 25, 2011

conversationalist

rjmccall posted:

Again, I am not disputing and never did dispute that the Objective-C containers are perfectly fine for the vast majority of code. Their performance is sub-optimal but not indecently so, and even if they were unspeakably terrible, most code in the world has no serious performance constraints and only runs into problems due to poor choices at levels far above the choice of container implementation.

This is still rather misleading, I'd wager that the container classes are optimized to be reasonably close to optimal given the restrictions and design choices they're under (e.g. dynamic dispatch, switching internal representations for NSMutableArray, etc.). They just do so much extra stuff that you may or may not need / want, that something else might be more appropriate for your usage.
But as you say, if you're not doing anything pathological and your N is "reasonable", anything will work.

While this post on NSArray may be outdated by now, I still find it very interesting.

Adbot
ADBOT LOVES YOU

Sewer Adventure
Aug 25, 2004

rjmccall posted:

Everyone I know that works on WebKit, including a lot of its technical leadership, would laugh you out of the room for suggesting that their use of C++ is simply a legacy holdover and that they'd be happier if it were written exclusively in Objective-C.

The only reason it is in C++ is because it started in C++. If Apple started a web renderer from scratch it would be in Objective C.

quote:

Defining WebKit out of your sample is silly, because WebKit is one of only a few standard apps that both (1) actually has to work with large amounts of data and (2) cares about the speed of access to them. Stocks could hold its monitored ticker symbols in a linked list and do O(n^3) work on every UI refresh and it would be hardly one user in a million who ever even noticed a slowdown. The size of a typical address book is dwarfed by the number of DOM nodes on google.com. Mail is the only real competitor here, and Mail has serious performance problems with large mailboxes, although I doubt that has anything to do with NSArray.

Google Maps is very performant and is not C++

wolffenstein
Aug 2, 2002
 
Pork Pro
If C++ is "like running a chain saw with all the safety guards removed", Objective-C++ must be like trying to juggle that chain saw.

Echo Video
Jan 17, 2004

Sewer Adventure posted:

The only reason it is in C++ is because it started in C++. If Apple started a web renderer from scratch it would be in Objective C.


Google Maps is very performant and is not C++

Do you know what rjmccall does?

Dr Monkeysee
Oct 11, 2002

just a fox like a hundred thousand others
Nap Ghost

Sewer Adventure posted:

The only reason it is in C++ is because it started in C++. If Apple started a web renderer from scratch it would be in Objective C.

I find that highly unlikely unless they weren't planning on open-sourcing it. The fact that Webkit is C++ is one of the reasons it's been ported to practically everything.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

y_y posted:

This is still rather misleading, I'd wager that the container classes are optimized to be reasonably close to optimal given the restrictions and design choices they're under (e.g. dynamic dispatch, switching internal representations for NSMutableArray, etc.). They just do so much extra stuff that you may or may not need / want, that something else might be more appropriate for your usage.

That's a fair assessment. I didn't mean to suggest that the container classes were particularly poorly implemented given their constraints.

Incidentally, looking over the implementations some more, I would caution people (again, I mean people who care about this level of performance) against trying to access NSArrays with CF function calls; the CF functions will just turn around and do a message send when they detect an Objective-C object anyway.

I think that article is quite a bit out of date; NSMutableArray seems to be a pretty standard deque now.

Sewer Adventure posted:

The only reason it is in C++ is because it started in C++. If Apple started a web renderer from scratch it would be in Objective C.

Okay, look, I appreciate that you have a lot of loyalty to Objective-C and want to defend it against what you perceive as my unfair slights, but you are not actually contributing anything here besides unsubstantiated claims.

Sewer Adventure
Aug 25, 2004

rjmccall posted:

Okay, look, I appreciate that you have a lot of loyalty to Objective-C and want to defend it against what you perceive as my unfair slights, but you are not actually contributing anything here besides unsubstantiated claims.

My point is that Objective C++ is bad.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Sewer Adventure posted:

My point is that Objective C++ is bad.

What does that cite have to do with Objective-C++? And while you're here, care to appeal to any other authorities?

Fate Accomplice
Nov 30, 2006




If I'm going to start a simple new app, should I use storyboard/arc?

I know ARC is available for IOS4, but I'm pretty sure storyboard is not.

some kinda jackal
Feb 25, 2003

 
 
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.

Kekekela
Oct 28, 2004

Martytoof posted:

I'm actually kind of curious to hear everyone's thoughts on whether a new programmer should learn on ARC or not. Let's just say for the sake of arguing that backwards compatibility isn't an issue.
The new Stanford course teaches with ARC. Also its just syntactic sugar and the compiled result is basically the same, right? (so why not if that's the case...its really just removing tedium as Hegarty points out in the aforementioned course)

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

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.

Holy poo poo yes. There is no value in typing retainreleaseautorelease ten septillion times. Literally none.

some kinda jackal
Feb 25, 2003

 
 
Well I wasn't sure if there was any value in understanding memory management in (as) depth anymore. I've only gone through the first lecture so far and haven't seen whether he's going to bring up the concepts. For that matter, I'm not really sure how important it is to understand what happens behind the scenes anymore aside from "hang onto this" and "if nobody cares about X, we don't care either", so it's cool to hear from people who might have made the change to ARC and know their way around the language more than I do.

It's kind of sad how "use it or lose it" programming is for me. I was fairly comfortable with ObjC and Cocoa Touch two years ago, now I'm back at the "drooling babby" stage :(


Also I'm glad to hear Paul teaches with ARC enabled. I wasn't sure if that made the cutoff for this semester.

e: Oh my god, this setting in Organizer that lets me use my iPad for development remotely -- does this mean I can debug wirelessly as well? :psyduck:

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

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I understand your trepidation, and I'm sure you can find differing opinions, and sometimes it is important to understand what's going on under the hood, but gently caress memory management.

some kinda jackal
Feb 25, 2003

 
 
Is there any way to tell Xcode to insert opening braces on their own line?

So

-(blah)blah:(id)arg
{
}

instead of

-(blah)blah:(id)arg {
}

Don't know how much of a travesty that is, but it's how I've been accustomed to writing code and I think it's much more readable.

Kekekela
Oct 28, 2004

Martytoof posted:

Is there any way to tell Xcode to insert opening braces on their own line?

So

-(blah)blah:(id)arg
{
}

instead of

-(blah)blah:(id)arg {
}

Don't know how much of a travesty that is, but it's how I've been accustomed to writing code and I think it's much more readable.
Here's a stack-overflow question that addresses this (it looks like an older version of x-code but I'm guessing it should help)
http://stackoverflow.com/questions/392749/xcode-adjusting-indentation-of-auto-generated-braces

some kinda jackal
Feb 25, 2003

 
 
Thanks. Looks like it might be a pain when it would be easy to adjust to the new method so I might just try to live with it one of the simple solutions doesn't pan out. I came across a bunch of other stackoverflow solutions that were complex but somehow missed this one.


e: Followup:

Does Xcode not honour sender class definition when dragging an action from storyboard to an implementation?

I just dragged one of my UIButtons to my implementation file, told it to use UIButton instead of id as the sender but when it generated code it still declared the sender as id.

Kekekela
Oct 28, 2004
Just got a (2 GB) X-Code update, I guess they just send down the whole app for every update? :psyboom:

some kinda jackal
Feb 25, 2003

 
 
Yeah I thought they were doing delta updates. I was pissed when I saw the two-point changelog and a 1.8gb download :mad:

edit: Weren't some of the previous 4.x updates pushed out as deltas? I know I didn't download 2 gigs a pop every time.

wolffenstein
Aug 2, 2002
 
Pork Pro
Welcome to Apple development enjoy your stay.

lord funk
Feb 16, 2004

And don't forget to archive your old SDKs (assuming you still want to compile to them).

Kekekela
Oct 28, 2004
Its kind of doubly annoying that it doesn't actually update the app, but instead you have to go into apps and run the install.

some kinda jackal
Feb 25, 2003

 
 
Eh, I don't mind that. I was dicking around in Xcode when I started the update download. I don't want App Store to decide when I should run the update, especially if it's a 2gb download that could take some time.

I mean if it was a delta update that was like 100mb then maybe I'd feel better about letting App Store automatically update the devtools right there and then.

Kekekela
Oct 28, 2004

Martytoof posted:

Eh, I don't mind that. I was dicking around in Xcode when I started the update download. I don't want App Store to decide when I should run the update, especially if it's a 2gb download that could take some time.

I mean if it was a delta update that was like 100mb then maybe I'd feel better about letting App Store automatically update the devtools right there and then.

Yeah, I mean I don't mind now that I'm aware of it...I guess I should just say its counter-intuitive the first time you go through it given how the updates for other apps work. When I downloaded the first version after ios5 came out I spent a week trying to figure out why I wasn't seeing the ARC option. :downs:

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

What's the best way to do non-Tab View tabs?



Those would even be fine. I was thinking of making a row of gradient buttons, then altering their properties (mainly width and if the border is visible) based on which one is 'active'. Like this:



Then when I click on a 'tab', I just make the TextView that it's linked to visible (one tab and one text view for each IRC channel).

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane
Okay, so I want to make a free version of one or two of my apps to get people to download it and try it, because my sales numbers have gone up for the one app I made a free version of. The problem is that Apple rejected this app because, despite the huge number of Lite/Free versions of things on the app store, it's forbidden.

What I want to do is transition the current (paid) version to a $0 price, and allow people to unlock the full feature set through an In-App purchase worth the original price of the app. I don't want to make people pay twice, because that's obviously not fair. Will Apple moan if I figure out a way to have the features unlocked for users who have already paid for the app once? Are there any best practices I should follow for this situation?

Fate Accomplice
Nov 30, 2006




I just signed up for the paid developer program last night so I can test on the device / release etc.

I prefer to plug my phone in as rarely as possible, so I figured I'd set up testflight so I can test my own builds over the air.

If I'm doing that, do I still need to go through the provisioning process in the developer portal?

I'm trying to follow testflight's setup doc here, http://support.testflightapp.com/kb/tutorials/how-to-create-an-ipa-xcode-4 , but I'm unable to get the archive to build - I get a "Code signing error, profiles don't match a valid key/value pair in default keychain" error. I actually do have a certificate in my keychain that I downloaded and added last night.

Any ideas?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
You need a distribution cert (Provisioning Portal -> Certificates -> Distribution), and then you'll need to add your phone (Provisioning Portal -> Devices -> Upload Devices, pop in the txt file you export from TestFlight), and then you'll need to make an App ID (Provisioning Portal -> App IDs -> New App ID -> enter 'com.yourcompany.*' as the suffix, replace with your actual info), and finally you'll need to make a provisioning profile that combines all this poo poo (Provisioning Portal -> Provisioning -> Distribution -> New Profile, 'Ad Hoc', pick your app ID, pick your device).

If/when you push to the app store, you'll usually want unique app IDs for each app you have in the store, but for TestFlight etc. just use the wildcard one above.

Also, if you decide to add more devices in the future, just add the devices' UDIDs, edit your existing ad hoc distribution provisioning profile, and download the updated profile.

e: forgot the 'add device' step.

pokeyman fucked around with this message at 21:21 on Nov 20, 2011

Doc Block
Apr 15, 2003
Fun Shoe

PT6A posted:

Okay, so I want to make a free version of one or two of my apps to get people to download it and try it, because my sales numbers have gone up for the one app I made a free version of. The problem is that Apple rejected this app because, despite the huge number of Lite/Free versions of things on the app store, it's forbidden.

What I want to do is transition the current (paid) version to a $0 price, and allow people to unlock the full feature set through an In-App purchase worth the original price of the app. I don't want to make people pay twice, because that's obviously not fair. Will Apple moan if I figure out a way to have the features unlocked for users who have already paid for the app once? Are there any best practices I should follow for this situation?

Maybe you could push out one more update before you go freemium, and all that one update does is put a file named paidfor.dat in the app's Documents folder (or adds it to the app's settings, or whatever).

Then when you do your freemium update you change it so it instead looks for paidfor.dat and if it's there then you know it's an existing user.

Or something along those lines. Doing it exactly like this will be trivially easy for pirates to circumvent, but they're gonna try to get at the paid parts of your app any way you do it.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
Then if anyone ever reinstalls the app, they're screwed.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

PT6A posted:

Okay, so I want to make a free version of one or two of my apps to get people to download it and try it, because my sales numbers have gone up for the one app I made a free version of. The problem is that Apple rejected this app because, despite the huge number of Lite/Free versions of things on the app store, it's forbidden.

What I want to do is transition the current (paid) version to a $0 price, and allow people to unlock the full feature set through an In-App purchase worth the original price of the app. I don't want to make people pay twice, because that's obviously not fair. Will Apple moan if I figure out a way to have the features unlocked for users who have already paid for the app once? Are there any best practices I should follow for this situation?

I'd probably just send a note to the app store review team and ask. Probably won't get a quick response though. Might be faster to appeal the rejection with an explicit request for a way to do what you're trying to do. And in the meantime, see if you can find any other apps that have done the same thing (if any) and ask their developers what they did.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Martytoof posted:

e: Oh my god, this setting in Organizer that lets me use my iPad for development remotely -- does this mean I can debug wirelessly as well? :psyduck:

Apparently, though I'm having some trouble getting it to work. Someone on StackOverflow has some useful info.

e: Success! After following the instructions at the above link, I unchecked then checked the setting in Preferences > General.

pokeyman fucked around with this message at 22:52 on Nov 20, 2011

PT6A
Jan 5, 2006

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

Doc Block posted:

Maybe you could push out one more update before you go freemium, and all that one update does is put a file named paidfor.dat in the app's Documents folder (or adds it to the app's settings, or whatever).

Then when you do your freemium update you change it so it instead looks for paidfor.dat and if it's there then you know it's an existing user.

Or something along those lines. Doing it exactly like this will be trivially easy for pirates to circumvent, but they're gonna try to get at the paid parts of your app any way you do it.

This was the idea I already had, but as you and others bring up, it's reasonably problematic due to reinstallation problems, ease of circumvention, etc.

I haven't used the In-App API before, but would this be possible?

1) Create an update to the curent app at the current price which automatically purchases a 0-cost in-app purchase.
2) Create a second update with the desired upgrade interface, which is downloadable for free, which checks for the free in-app purchase created by the version in step 1 OR the paid in-app purchase.

Doc Block
Apr 15, 2003
Fun Shoe
No, I don't think so. For obvious reasons, in-app purchases require user approval. In fact, if memory serves, once the app tries to initiate an in-app purchase iOS itself takes over and asks the user if this is what they actually want to do.

edit: and even if the API allowed it, it's doubtful that Apple would be OK with a secret in-app purchase even if it was free. Apple has to approve your in-app purchase items too.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

PT6A posted:

This was the idea I already had, but as you and others bring up, it's reasonably problematic due to reinstallation problems, ease of circumvention, etc.

I haven't used the In-App API before, but would this be possible?

1) Create an update to the curent app at the current price which automatically purchases a 0-cost in-app purchase.
2) Create a second update with the desired upgrade interface, which is downloadable for free, which checks for the free in-app purchase created by the version in step 1 OR the paid in-app purchase.

Doc Block's right about requiring interaction, but couldn't you add the in-app purchase for $0 and push an update that says "buy this $0 thing if you don't want to pay for the update that comes out in a month", then change the price of the in-app purchase at the same time you change the app price.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Or maybe make the app free for a couple weeks, and after that activate the in-app purchase, and hope that everyone upgrades during the grace period.

some kinda jackal
Feb 25, 2003

 
 
Has anyone had any permissions issues with Xcode since updating to whatever was just released?

I'm having a weird issue:



But:



Please ignore the fact that it's on dropbox in the screenshot. I tested and get the same problem if I start a new project and save it to local disk.

This project isn't under source control or anything, not sure where to go with this.

e: Disregard, a reboot solved this. GHOST OF STEVE :argh:

some kinda jackal fucked around with this message at 18:16 on Nov 22, 2011

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





I'm trying to wrap my head around ARC for a new project. I understand reference counting, but I can't find anywhere that states when increments/decrements are performed and whether you can change a strong reference to a weak reference or vice versa. If I have an object with a strong pointer to some other object, and I want to later assign a different object to that pointer, do I need to do anything other than assign the new object via the setter? Will that decrement the old objects count and increment the new objects count? What if I want to assign a new object but change the reference from strong to weak? Is that even possible? Is there a better resource than this?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

the talent deficit posted:

If I have an object with a strong pointer to some other object, and I want to later assign a different object to that pointer, do I need to do anything other than assign the new object via the setter?

No.

quote:

Will that decrement the old objects count and increment the new objects count?

Yes.

quote:

What if I want to assign a new object but change the reference from strong to weak? Is that even possible?

No.

quote:

Is there a better resource than this?

Your questions actually have nothing to do with ARC, so I'd start with declared properties as a language construct and then look over memory management and accessor methods.

Adbot
ADBOT LOVES YOU

Toady
Jan 12, 2009

Sewer Adventure posted:

The only reason it is in C++ is because it started in C++. If Apple started a web renderer from scratch it would be in Objective C.

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.

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