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
rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
A 2006-era Macbook has a 32-bit-only processor and so will be very limiting. You will not be able to install the latest operating system, which means you won't be able to install future versions of the tools. I strongly recommend at least getting something that's 64-bit capable.

rjmccall fucked around with this message at 22:07 on Sep 19, 2012

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
According to everymac the late-2006 MacBook has a T5600, which according to Intel is 64-bit. Though there could well be other requirements preventing Mountain Lion from being installed.

That said, while you'll be fine right this second, it won't be long until a late-2006 MacBook won't build apps you can submit to the App Store. If that's not a problem for you, super.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Ah, you're right, the *late* 2006 MacBooks can run 64-bit code. They are not, however, supported by Mountain Lion.

Doc Block
Apr 15, 2003
Fun Shoe
Anything with Intel's GMA 950 GPU (including that Macbook Air) won't run Mountain Lion.

Get something else.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Vashro posted:

everywhere I've read (including this thread) does say 2007 or later

Updated OP to be more accurate about this.

Small White Dragon
Nov 23, 2007

No relation.
I know it represents a shrinking portion of the market, but I'm kind of bummed that XCode 4.5 doesn't support armv6.

Doc Block
Apr 15, 2003
Fun Shoe
Even the 3GS was armv7.

HiriseSoftware
Dec 3, 2004

Two tips for the wise:
1. Buy an AK-97 assault rifle.
2. If there's someone hanging around your neighborhood you don't know, shoot him.

Small White Dragon posted:

I know it represents a shrinking portion of the market, but I'm kind of bummed that XCode 4.5 doesn't support armv6.

I did some Googling and found this blog that describes a way to compile armv6 with 4.5. It basically involves copying the iOS 5.1 SDK from an older version of Xcode and fiddling with the build settings, like typing in certain things manually since Xcode doesn't have a dropdown selection for them. In these projects you can build armv6/7 instead of armv7/7s (there's no way to do armv6/7/7s)

http://blog.chpwn.com/post/31824877081

tarepanda
Mar 26, 2011

Living the Dream

ultramiraculous posted:

In XCode, you can go into Organizer when the device plugged and get all the files your app created off. Basically just go to Applications on the device, then choose the app you want, when choose download, and you'll end up with a bundle of everything in that app's sandbox.

That's pretty much exactly what I wanted, thanks! I wish they would let you grab individual files...

Vashro
May 12, 2004

Proud owner of Lazy Lion #46
Thanks for all the info, goons. I'll keep shopping. Suppose it can't hurt to shell out a few extra bucks for assurance and performance.

tarepanda
Mar 26, 2011

Living the Dream
Was the in-app purchase hack ever fixed?

kitten smoothie
Dec 29, 2001

Small White Dragon posted:

I know it represents a shrinking portion of the market, but I'm kind of bummed that XCode 4.5 doesn't support armv6.

So suppose I still have enough (vocal) users using 1st & 2nd-gen devices that I don't want to drop support for them yet. Mainly it's a case that the app is connected with a non-profit organization, and some of the people with older devices have older devices because they're too busy giving money to the non-profit rather than Apple. So I don't want to piss them off just yet even though here in the real world we know when it's time to walk away from a 4 year old device.

But I don't want my app to look like crap on iPhone 5 either.

Can I keep using 4.4 to build, put the Default-568h@2x.png file in there, and that's all it would take to force it to run in tall mode on an iPhone 5? Then if I'm being smart enough about laying out my UI relative to the window size, everything'd be great on either device?

Or do I need to actually build against 4.5 and the iOS 6 SDK?

kitten smoothie fucked around with this message at 16:43 on Sep 20, 2012

Funso Banjo
Dec 22, 2003

Am i reading this latest email from apple right?

If your app uses a resolution specifically for iphone 5 include iphone 5 screenshots screenshots. If it normal or retina sized, just regular shots are ok?

It's tempting to read it as saying you must include shots to show how it looks on the new phone. But it's not actually saying that, right?

Doc Block
Apr 15, 2003
Fun Shoe
If your app supports the iPhone 5 then you should probably have iPhone 5 screenshots. Just take them with the simulator if you need to.

duck pond
Sep 13, 2007

Hey so I keep hearing a lot about 'only running UI on the main thread' etc.

Does anybody know of any tutorials showing a pattern or way for setting about doing this?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
code:

dispatch_async(dispatch_get_main_queue(), ^{
  // do ui stuff
}

Change to dispatch_sync to wait until the block is done.

Doc Block
Apr 15, 2003
Fun Shoe
You just use NSOperationQueue or GCD to run other stuff on a background queue, which will run in its own background thread. Then, when that other thing is done, have it add a block to the main queue (which runs on the main thread) which updates your UI to say its done or whatever.

Apple has posted a WWDC 2012 video about it, I think the video was called Developing Concurrent UIs. It talks about how to offload long-running tasks to a background queue, even expensive drawing operations.

Doc Block
Apr 15, 2003
Fun Shoe

pokeyman posted:

code:

// from the main thread
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    // do background stuff
    dispatch_async(dispatch_get_main_queue(), ^{
        // do ui stuff to indicate background thing is done
    });
});

Change to dispatch_sync to wait until the block is done.

Clarified your example.

Calling GCD directly is fine for one-off instances of needing to perform something off the main thread, but for anything where you're adding a bunch of stuff to a background queue you're better off making your own queue(s) and using NSOperationQueue to manage them because you can cancel execution of that queue and whatnot.

Also, be careful with dispatch_sync(). Trying to use it to add a block to the calling thread will cause a deadlock.

Doc Block fucked around with this message at 00:11 on Sep 21, 2012

tarepanda
Mar 26, 2011

Living the Dream
I'm having a really weird problem here.

I have nested enumerations with ALAssetsLibrary; the top one goes through albums until it finds the album I want; then I get the number of assets and enumerate the pictures.

The problem is that while I get the correct number of assets, when I make a range from it (NSMakeRange[0, numberofAssets]), the range is out of bounds. I've verified through NSLog that the number of assets is what I'm expecting -- i.e., if I have the album with one picture in it, it will show as having one asset, but trying to enumerate that album results in an out of bounds error.

What the heck is happening here?

Edit: Googling and testing seems to indicate that this is Apple's problem as the ALAssetsLibrary isn't being updated properly. I even tried registering an observer so that I would know for sure that the library had been updated, but even then, I still get segfaults with out of range errors.

So I figured, worst-case scenario, I'd just make users go to the Photos app with a button -- but apparently there's no URL scheme for that. ugh.

tarepanda fucked around with this message at 07:37 on Sep 21, 2012

LP0 ON FIRE
Jan 25, 2006

beep boop
Does anyone know what the memory usage is for CAGradientLayer can be? I'm using it a background that fills the entire screen for an iPad gen 3 game, and I'm planning to sometimes have two loaded at once when they need to do a sliding transition.

Doc Block
Apr 15, 2003
Fun Shoe
If its cached (probably) rather than redrawn every frame, it would take up 2048x1536x4 bytes, so about 12 megabytes.

LP0 ON FIRE
Jan 25, 2006

beep boop

Doc Block posted:

If its cached (probably) rather than redrawn every frame, it would take up 2048x1536x4 bytes, so about 12 megabytes.

Yikes! That's way more than I was hoping for. It's not being redrawn 99% of the time, unless it's slid off the screen. It sounds strange, but I'm using Cocos2D with a transparent background so that I can have my own parallax background and gradient that's unaffected by whatever Cocos2D scene transitions that occur. Does anyone know of a better alternative to CAGradientLayer that's less memory hungry and still not CPU intensive? It doesn't have to look super smooth or that good. Maybe there's a way to still use CAGradientLayer while filling up the screen and using less memory, in trade of quality?

Doc Block
Apr 15, 2003
Fun Shoe
Any Retina full-screen element on the iPad 3 is going to have a 12 megabyte backing store.

LP0 ON FIRE
Jan 25, 2006

beep boop
Thanks for your info. Does it have to be retina? Or does it not make a difference if it covers the screen?

Froist
Jun 6, 2004

LP0 ON FIRE posted:

It sounds strange, but I'm using Cocos2D with a transparent background so that I can have my own parallax background and gradient that's unaffected by whatever Cocos2D scene transitions that occur.

I don't think this is that strange is it? I did the same (but with a static UIImage) on a game I finished recently.

stray
Jun 28, 2005

"It's a jet pack, Michael. What could possibly go wrong?"
I'm still working on that branch schedule app and I was wondering: is there a way to efficiently update the schedules from online? (As in, the app should check a specific URL for the schedule plist and if it's been updated, download/store it and then use that new plist.)

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I'm not sure what you're asking. That sounds like a perfectly good solution. Is there something you're stuck on?

Binary
May 21, 2004
I have these two files, Text.h and Text.m in one of my projects. With the code below xcode gives a warning that there is no prototype for the function Test() and an error when I try to use the NSString myText saying that myText is an undeclated identifier. This exact setup will work in another .h and .m file that declares a UIImage view, the only difference I can see is that this class is a UIView.

Text.h:
code:
#import <UIKit/UIKit.h>
@interface Text : UIView
{
    NSString *myText;
}

@property(nonatomic, retain) NSString *myText;

void Test();

@end
Text.m:
code:
#import "Text.h"

@implementation Text

@synthesize myText;

void Test()	// Warning about lack of function prototype

{
    NSString *foo = myText;	// Error that myText is an undeclared identifier
}
@end

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
You want to define an instance method.

Remember myText in instance methods is shorthand for self->myText, where self is the implicit first parameter to a method call. Your function isn't defined as a method, so there's no self to dereference, and there's no myText in scope, hence the error.

Doc Block
Apr 15, 2003
Fun Shoe
Yeah, like pokeyman said, to access instance variables like that you need to do it inside an Objective-C instance method so that you have a valid self pointer, but in your code Test() is a C function. Change it to:
Objective-C code:

//Text.h
- (void)test;

//Text.m
- (void)test
{
    NSString *foo = myText; // compiler turns this into
    // NSString *foo = self->myText
}

to make it an instance method.

Doc Block fucked around with this message at 01:26 on Sep 23, 2012

dizzywhip
Dec 23, 2005

Has anyone else been experiencing performance problems in Xcode since updating to 4.5? After about 2 or 3 hours I have to restart it because it becomes unusable.

tarepanda
Mar 26, 2011

Living the Dream
I was having a few -- for example, it was sucking up over 2 GB RAM at one point while doing nothing but displaying code. A reboot seems to have fixed it, though.

Doc Block
Apr 15, 2003
Fun Shoe
Nope. Running fine so far.

Ran into something interesting with the iPhone 5: your views aren't iPhone 5-sized when loaded. So if you add any CALayers to a view in, say, the view controller's viewDidLoad, those layers will be normal size instead of iPhone 5 size. Even if you do it the right way and set the layer's frame with "whateverLayer.frame = self.view.bounds;" or something, the layer will be normal size because the view will still be normal size at that point.

You have to go into your XIB and either set the simulated size to Retina 4" (so much for the Simulated Metrics just being something to help you design in IB), resize whatever layers etc. you've added manually, or wait to create the layers (or whatever) until viewWillAppear.

Binary
May 21, 2004

Doc Block posted:

Yeah, like pokeyman said, to access instance variables like that you need to do it inside an Objective-C instance method so that you have a valid self pointer, but in your code Test() is a C function. Change it to:
Objective-C code:
//Text.h
- (void)test;

//Text.m
- (void)test
{
    NSString *foo = myText; // compiler turns this into
    // NSString *foo = self->myText
}
to make it an instance method.

That fixed it, thanks. So it seems that previously I was defining a function in general terms rather than as a class method.

Doc Block
Apr 15, 2003
Fun Shoe
Be aware that there's a difference between a class method and an instance method. A class method does not require a specific instance of that class to work, where an instance method does.

For instance, when you load an image with UIImage *image = [UIImage imageNamed:@"image.png"]; you're using the UIImage class's class method "imageNamed". Class methods are denoted in source code with a + instead of -, so if you wanted to do a convenience class method that creates new instances of that class you'd do something like:
Objective-C code:
// Person.h

+ (Person *)personWithFirstName:(NSString *)firstName lastName:(NSString *)lastName age:(NSInteger)age;

// Person.m

+ (Person *)personWithFirstName:(NSString *)firstName lastName:(NSString *)lastName age:(NSInteger)age
{
    // For illustration, Person class doesn't have an initializer that takes first and last names or the age
    Person *someone = [[Person alloc] init];
    someone.firstName = firstName;
    someone.lastName = lastName;
    someone.age = age;    // OR
    // someone->age = age if you want to access the instance variable directly, but this won't trigger KVO or any other potential side effects of setting the age property
    // Class methods don't get a "self" pointer, though, so we can't do
    // _age = age;
    // because the compiler has no way to know which instance we want to do that for.

    return someone;
}
Class methods don't get a self pointer, because it isn't meant to be something that you use to operate on a specific instance (except when using a class method as an instance creator method).

Plorkyeran
Mar 22, 2007

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

Gordon Cole posted:

Has anyone else been experiencing performance problems in Xcode since updating to 4.5? After about 2 or 3 hours I have to restart it because it becomes unusable.
Having to restart Xcode every few hours would not be anything new for me. It's one of the least stable programs I've spent any significant amount of time using.

At least it starts up quickly.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
It's far from problem free, but 4.5 has been an amazing step up from 4.3 in terms of bug fixes and compiler improvements as far as I've seen. I've been very happy with 4.5 since one of the dev previews. That said, I've still had to fuxcode once a month or so when weird things start happening.

Toady
Jan 12, 2009

Xcode has come a long way since 4.0.

Carthag Tuek
Oct 15, 2005

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



Doc Block posted:

Class methods don't get a self pointer, because it isn't meant to be something that you use to operate on a specific instance (except when using a class method as an instance creator method).

You do get a self pointer, but it points to the class and you probably shouldn't modify it (I've never tried but I can't imagine it'd do any good). I sometimes do things like this for convenience constructors:

Objective-C code:
+ (id)nodeWithTag:(NSString *)tag value:(NSString *)value
{
    return [[self alloc] initWithTag:tag value:value xref:nil subNodes:nil];
}

+ (id)nodeWithTag:(NSString *)tag xref:(NSString *)xref
{
    return [[self alloc] initWithTag:tag value:nil xref:xref subNodes:nil];
}
e: I believe the recommendation is to have one canonical -initWhatever method, and have all other inits and constructors use that in order to have the least code duplication and a single point of entry taking care of all necessary setup.

Carthag Tuek fucked around with this message at 13:04 on Sep 23, 2012

Adbot
ADBOT LOVES YOU

Doc Block
Apr 15, 2003
Fun Shoe
Yeah, every class should have a designated initializer.

I didn't know that class methods got a self pointer that points to the class, though. Thanks.

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