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
Heisenberg1276
Apr 13, 2007

pokeyman posted:

Perhaps you are looking for child windows?

That was it, awesome.

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

lord funk posted:

Holy poo poo, thank you. I enabled NSZombieEnabled as an environment variable instead, and it points to exactly what was called.

Now excuse me while I go commit suicide for spending months debugging like a caveman.

Feel even dumber maybe!

Mac OS X Debugging Magic
iOS Debugging Magic

lord funk
Feb 16, 2004

pokeyman posted:

Feel even dumber maybe!

Mac OS X Debugging Magic
iOS Debugging Magic

:lol: at the top note:

Apple posted:

If you're developing for iOS, you should look through this list to see if you're missing out on something that will make your life easier.

Yep, nailed it right there.

Kekekela
Oct 28, 2004

Sulk posted:

I've been working my way through Programming in Objective-C and it's been mostly understandable so far, but I've been trying to keep pushing through the book even if I don't completely understand something. I figure that over time I'll see enough uses of various things that it'll become ingrained in my head, much like actual languages. Does that make sense? Also, what is a good book to pick up for iOS development itself? There's one I saw by the same publisher which has a new edition coming out next month, but if anyone has any suggestions it'd be appreciated.

Not a book, but if you search iTunes for "Stanford iOS" its got their whole iOS development course. Printed materials are here: http://www.stanford.edu/class/cs193p/cgi-bin/drupal/downloads-2010-fall

I'm a couple weeks in and its been pretty awesome so far.

Funso Banjo
Dec 22, 2003

Sales and Trends, and Financial Reports never sync for me.

Sales and Trends tells me I had 950 "paid apps" in fiscal September. I checked, and yep, that counts only type 1 sales, and less than 10 promo codes. Type 7's are not included in your daily "paid apps" figure. Type 7's being the apps that are already owned being redownloaded or loaded onto another device.

But on my September financial report, which is all finished now, I have only 651 "Total Units Sold".

I am contacting them now, but fully expect a vague response.

PT6A
Jan 5, 2006

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

Funso Banjo posted:

Sales and Trends, and Financial Reports never sync for me.

Sales and Trends tells me I had 950 "paid apps" in fiscal September. I checked, and yep, that counts only type 1 sales, and less than 10 promo codes. Type 7's are not included in your daily "paid apps" figure. Type 7's being the apps that are already owned being redownloaded or loaded onto another device.

But on my September financial report, which is all finished now, I have only 651 "Total Units Sold".

I am contacting them now, but fully expect a vague response.

Are you certain that you've received reports from all markets? Granted, I wouldn't expect it to be off by 300, but my September financial reports have been trickling in over the past two weeks instead of all at once like they usually do.

Earth
Nov 6, 2009
I WOULD RATHER INSERT A $20 LEGO SET'S WORTH OF PLASTIC BRICKS INTO MY URETHRA THAN STOP TALKING ABOUT BEING A SCALPER.
College Slice
I'm trying to pick up programming as a hobby again and I've run into something that has confused me. Searching Google and Youtube has not yielded anything yet which is only piling on the frustration. I'm extra frustrated because I swear I saw a Youtube video eight months ago that addressed this exact thing. So my problem right now is trying to understand why when I make a UIScrollView an instance variable to a ViewController class I cannot seem to add it as a subview to the ViewController's view. However, when I just create the object during runtime in the view did load method of the ViewController and go to add it as a subview to the view it works just fine.

code:
ScrollViewViewController.h:
__________________________
#import <UIKit/UIKit.h>

@interface TempAppViewController : UIViewController <UIScrollViewDelegate> {
	
	UIScrollView *scrollView;
	
}

@property(nonatomic, retain) UIScrollView *scrollView;

@end
__________________________

ScrollViewViewController.m:
__________________________
#import "TempAppViewController.h"

@implementation TempAppViewController

@synthesize scrollView;

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
	[scrollView initWithFrame:CGRectMake(0, 120, self.view.frame.size.width, 240)]; 
	[self.view addSubview:scrollView];
	scrollView.backgroundColor = [UIColor redColor];

	self.view.backgroundColor = [UIColor greenColor];
	
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (void)dealloc {
	[scrollView release];
    [super dealloc];
}

@end
Results:


code:
ScrollViewViewController.h:
__________________________
#import <UIKit/UIKit.h>

@interface TempAppViewController : UIViewController <UIScrollViewDelegate> {
	
}

@end
__________________________

ScrollViewViewController.m:
__________________________
#import "TempAppViewController.h"

@implementation TempAppViewController

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
	UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 120, self.view.frame.size.width, 240)]; 
	[self.view addSubview:scrollView];
	scrollView.backgroundColor = [UIColor redColor];

	self.view.backgroundColor = [UIColor greenColor];
	
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (void)dealloc {
    [super dealloc];
}

@end
Results:


I don't know why I can't use an instance variable to define the objects that I want to be located in my view. Or I don't know what I'm doing wrong to make it not work right. Could anyone please shed some light on this?

Kekekela
Oct 28, 2004
I think in that first one you want to be using [self scrollview] (or self.scrollview) to hit your property, the way you're doing it you're accessing the instance variable directly.

disclaimer:I'm new to IoS dev also so I may just be blowing out of my rear end here.

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane
Who would've guessed that iOS 5 would randomly break certain dead simple features in two of my apps? Certainly not me!

I mean, I guess I should've been testing everything with iOS 5 when it was in beta, but shouldn't a little more emphasis be put on maintaining backward compatibility, Apple? If my combination of SQLite database and TableViewController breaks (for some reason, it doesn't break completely either; only one view doesn't work), God knows what might be happening with other apps that do something, ya know, remotely complex.

OHIO
Aug 15, 2005

touchin' algebra
code:
[scrollView initWithFrame:CGRectMake(0, 120, self.view.frame.size.width, 240)];

You need to allocate memory for your object before you can initialize it, even if it's an instance variable.

So do what you already did in your next example:

code:
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 120, self.view.frame.size.width, 240)];
but without declaring it as a local variable (since you declared it as an instance variable). (also be sure to release it in your -viewDidUnload since you're creating it in -viewDidLoad)

lord funk
Feb 16, 2004

I'm in the habit of doing something like this:

code:
@synthesize scrollView = _scrollView;
then initializing the instance

code:
UIScrollView *_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 120, self.view.frame.size.width, 240)];
But does the scrollview really have to be a property in this case? Does it need that accessibility?

OHIO
Aug 15, 2005

touchin' algebra

lord funk posted:

I'm in the habit of doing something like this:

code:
@synthesize scrollView = _scrollView;
then initializing the instance

code:
UIScrollView *_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 120, self.view.frame.size.width, 240)];
But does the scrollview really have to be a property in this case? Does it need that accessibility?

Won't the compiler complain about you declaring a local variable when you declared it as an instance variable?

Earth
Nov 6, 2009
I WOULD RATHER INSERT A $20 LEGO SET'S WORTH OF PLASTIC BRICKS INTO MY URETHRA THAN STOP TALKING ABOUT BEING A SCALPER.
College Slice

OHIO posted:

Won't the compiler complain about you declaring a local variable when you declared it as an instance variable?

It does complain at me when I tried that. I'm not at home right now so I'll have to wait about nine hours to fix it, but I think that what I should be doing is just deleting the instancing of scrollView in the method viewDidLoad so it will look like: scrollView = [[UIScrollView alloc] init...

The reason I'm making an instance variable of it is so any other methods in the ViewController class will be able to access it if they need to. I'm trying to make a budget app, and I've made the decision to program as much of the view as I'm able to to minimize the use of the interface builder as much as I can. Since I'm programming the view I've been led to believe it's good to have the buttons, views, labels, etc. as instance variables of the view so all methods can interact with them. Say you type in one number in a text field and I want it to change a view. Wouldnt that method have to be able to effect the views? I hope what I'm trying to say kind of makes sense.

lord funk
Feb 16, 2004

Yeah, sorry. It should only be

code:
_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 120, self.view.frame.size.width, 240)];

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane
In case anyone is having trouble with bugs after the iOS 5 upgrade (yes, I'm probably the only lazy jerk that didn't download the iOS 5 beta), both of the problems I've encountered have been related to the order in which methods are called during startup. God knows why they worked on iOS 3 and 4 after I had a careful look at things, but they did, and now they don't.

stray
Jun 28, 2005

"It's a jet pack, Michael. What could possibly go wrong?"
According to the BNR book, the initializer chain says that when you designate an initializer (which I'll call initWithCustomStuff: for this example), you do all your init stuff in there and then just point the regular init method at it, like so:
code:
- (id)initWithCustomStuff:(NSString *)s {
	self = [super init];
	if (self) {
		// All your custom initializer stuff
	}
	return self;
}

- (id)init { return [self initWithCustomStuff:@"boners"]; }
Is there a way to get the everyday init method to pass a non-predetermined argument (cf. boners) on to initWithCustomStuff: this?

code:
- (id)init { return [self initWithCustomStuff:foo]; }
I want to make sure that every time the object gets initialized, the parameter is passed on to the designated initializer.

stray fucked around with this message at 04:00 on Oct 19, 2011

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

stray posted:

According to the BNR book, the initializer chain says that when you designate an initializer (which I'll call initWithCustomStuff: for this example), you do all your init stuff in there and then just point the regular init method at it, like so:
code:
- (id)initWithCustomStuff:(NSString *)s {
	self = [super init];
	if (self) {
		// All your custom initializer stuff
	}
	return self;
}

- (id)init { return [self initWithCustomStuff:@"boners"]; }

Just to clarify, you override the superclass's designated initializer and point that to your designated initializer. (Though overriding -init as well might not be a bad idea.)

quote:

Is there a way to get the everyday init method to pass a non-predetermined argument (cf. boners) on to initWithCustomStuff: this?

code:
- (id)init { return [self initWithCustomStuff:foo]; }
I want to make sure that every time the object gets initialized, the parameter is passed on to the designated initializer.

Well, instance variables are out as you're not yet initialized. So you're pretty much stuck with something predetermined (i.e. known at compile-time) or some global variable. Typically you'll pass in nil or some useful default value. If for whatever reason your class simply won't work when initialized with -init, throw an exception.

double sulk
Jul 2, 2010

I need some serious help because I don't think this is (at least mostly) my fault.

I just got the Big Nerd Ranch book for iOS programming and I'm having issues from the get go. The problems probably stem from the fact that I'm using Xcode 4.2, but I'm wondering if there are simply some core changes that I need to be aware of that will contradict what the book is having me do (and simply do new correct things when need be).

The first chapter has you make a simple question and answer application, and it seems as if the way things are linked is off. It would help if someone is familiar with the book and could visually see their examples, but the touch event is treated by default as "Touch Up Inside" now, and there aren't Outlets listed in the connections panel. I also had to add the Quiz App Delegate object manually so it could even find the showQuestion/showAnswer methods I'd defined in the delegate. I'm currently getting EXE_BAD_ACCESS errors and I'm not sure of how to change these things around to get the program working correctly.

Maybe I'm better off just returning the book and waiting for a new book to come out which supports the new version of Xcode? If the whole thing would be an exercise in frustration otherwise, I'm sure it'd be the logical thing to do. In the meantime I'll keep screwing around with it if I can and maybe I just did something dumb, but it's frustrating that Apple seemingly makes such dramatic changes between versions.

Cylon Dinner Party
Dec 2, 2003

bored now.

Sulk posted:

I just got the Big Nerd Ranch book for iOS programming and I'm having issues from the get go. The problems probably stem from the fact that I'm using Xcode 4.2
I'm in the same boat. I'll probably just go home for the weekend and try again on Monday.

This looks promising though: http://www.youtube.com/watch?v=sROdA4w4x9Y

double sulk
Jul 2, 2010

Cylon Dinner Party posted:

I'm in the same boat. I'll probably just go home for the weekend and try again on Monday.

This looks promising though: http://www.youtube.com/watch?v=sROdA4w4x9Y

Looking at/following the video, there's no "Outlet"/"delegate" anywhere to be found, which is basically the same problem I had before. I don't know what the issue is or what I'm doing wrong, but it's really frustrating.

Doc Block
Apr 15, 2003
Fun Shoe
Interface Builder is a little different than in 3.x, which is what the book is written for.

It's not way huge different, though. IMO most of the differences are just from the transition to one window instead of several. The object library is still over there on the right, the inspector (or whatever it used to be called) is in the top right, etc.

Of course, I'm in the middle of a project and so haven't looked at Xcode 4.2, so maybe it is really different than Xcode 4.1. (Gonna transition my app over to 4.2 this weekend)

Doc Block fucked around with this message at 03:45 on Oct 22, 2011

lord funk
Feb 16, 2004

What really bothers me is not knowing when a random blog post or article about Xcode is for 3 or 4. I tried (and failed) to get an ad hoc build for a beta tester, but I was piecing together different articles that were spanned 4 years apart.

Sewer Adventure
Aug 25, 2004

PT6A posted:

In case anyone is having trouble with bugs after the iOS 5 upgrade (yes, I'm probably the only lazy jerk that didn't download the iOS 5 beta), both of the problems I've encountered have been related to the order in which methods are called during startup. God knows why they worked on iOS 3 and 4 after I had a careful look at things, but they did, and now they don't.

One thing I noticed is that if you have a viewController's view as a subview, it now automatically calls viewWillDisappear, viewWillAppear &c. rather than you having to manually do it in the parent view controller.

double sulk
Jul 2, 2010

Doc Block posted:

Interface Builder is a little different than in 3.x, which is what the book is written for.

It's not way huge different, though. IMO most of the differences are just from the transition to one window instead of several. The object library is still over there on the right, the inspector (or whatever it used to be called) is in the top right, etc.

Of course, I'm in the middle of a project and so haven't looked at Xcode 4.2, so maybe it is really different than Xcode 4.1. (Gonna transition my app over to 4.2 this weekend)

I thought it was written for 4.1 as it was published not more than a few months ago..?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

lord funk posted:

What really bothers me is not knowing when a random blog post or article about Xcode is for 3 or 4. I tried (and failed) to get an ad hoc build for a beta tester, but I was piecing together different articles that were spanned 4 years apart.

Yeah, most posts give it away somehow (either explicitly, or via screenshots, or by you following the directions and heading down a cul-de-sac because the setting moved in this version), but it can be an hour later that you realize the version difference.

As for ad hoc builds and beta testing, here's a quick how to for Xcode 3 and Xcode 4, and then hit up the site I got those from to make your beta testing life easier.

stray
Jun 28, 2005

"It's a jet pack, Michael. What could possibly go wrong?"

Sulk posted:

Looking at/following the video, there's no "Outlet"/"delegate" anywhere to be found, which is basically the same problem I had before. I don't know what the issue is or what I'm doing wrong, but it's really frustrating.
Xcode 4.2 made some pretty big changes to the project templates and that update only came out in the last week or so. They're working on a third edition and there's a thread in the BNR forums that talks about this.

stray fucked around with this message at 18:33 on Oct 22, 2011

double sulk
Jul 2, 2010

stray posted:

Xcode 4.2 made some pretty big changes to the project templates and that update only came out in the last week or so. They're working on a third edition and there's a thread in the BNR forums that talks about this.

That's a great solution and at least the changes only affected the first few chapters, so Conway said. I won't be around until tomorrow to try it out, but I look forward to being able to, well, actually move forward with the text.

duck monster
Dec 15, 2004

lord funk posted:

What really bothers me is not knowing when a random blog post or article about Xcode is for 3 or 4. I tried (and failed) to get an ad hoc build for a beta tester, but I was piecing together different articles that were spanned 4 years apart.

The ad-hoc thing confused the poo poo out of me in xcode 4. From memory you need to basically get a new build config up for adhoc (Uh, just replicate the release one, and set it up for the right signing poo poo), then you archive it, then go to organizer and click send.

Apple need to seriously resist the urge to engage in magic though with this. The fact you cant select the build config makes me nervous as hell (What if I want *two* adhoc builds, one for internal testers, the other for beta testers, with different signing profiles? Or how about different build configs with various compiler flags. I dont know how to do that, and creating new targets is just fiddly as gently caress.)


e: Oh yeah and the whole not being able to set the base SDK to a 3.x one is pretty scary since I dont have a 3.x phone to test it, but every contract ever will ask for it.

duck monster fucked around with this message at 03:58 on Oct 23, 2011

duck monster
Dec 15, 2004

By the way. I've had upwards of 50 apps for various different dev contracts up on the store, but I havent once used a UINavigationController till the other day, when chasing some whacky issues with callbacks on UIViews that had been released just drove me so far up the wall I started hunting for alternatives.

I had just assumed it had to be used with listviews and required the bar.

Nope. And dear god are they easy to use. I wish I had explored this 2 years ago. I'm going to use these for loving everything now. The problems just ~=mAgIc=~ away.

Echo Video
Jan 17, 2004

Out of curiosity, what sort of techniques were you using before?

shodanjr_gr
Nov 20, 2007
I hope I don't get run out of this thread for asking this but is there a way to rebind Xcode shortcuts to better match those in VS2010 (particularly the debugging related stuff)?

PT6A
Jan 5, 2006

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

duck monster posted:

The ad-hoc thing confused the poo poo out of me in xcode 4. From memory you need to basically get a new build config up for adhoc (Uh, just replicate the release one, and set it up for the right signing poo poo), then you archive it, then go to organizer and click send.

Apple need to seriously resist the urge to engage in magic though with this. The fact you cant select the build config makes me nervous as hell (What if I want *two* adhoc builds, one for internal testers, the other for beta testers, with different signing profiles? Or how about different build configs with various compiler flags. I dont know how to do that, and creating new targets is just fiddly as gently caress.)


e: Oh yeah and the whole not being able to set the base SDK to a 3.x one is pretty scary since I dont have a 3.x phone to test it, but every contract ever will ask for it.

Create a "scheme" in the Scheme menu at the upper-left part of the window. This will allow you to create a different build configuration as before in the 'Edit Scheme' window. I think it might also be used to select a separate target.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

shodanjr_gr posted:

I hope I don't get run out of this thread for asking this but is there a way to rebind Xcode shortcuts to better match those in VS2010 (particularly the debugging related stuff)?

You'll certainly not get run out of here for dumping on Xcode!

You're looking for Xcode menu > Preferences > Key Bindings tab, filter by 'debug' or whatever.

some kinda jackal
Feb 25, 2003

 
 
Hey speaking of debug:

I was working on a little commandline app to do some file processing the other day, and I was NSLog-ging some output. Whenever I hit cmd-R to run the app it was like 50/50 whether the debugger/output window would stay open after it finished. Is there any rhyme or reason when that little window stays open? It was quite annoying having to mouse up to the top of the screen to open that window after the tool quit a good half of the time.

I hope I didn't just ask the stupidest question in the book, but it's got me stumped. I don't use xcode that often these days so -- :ohdear:

double sulk
Jul 2, 2010

So I'm working on examples again in the book and I've come across an odd issue which I can't entirely figure out. The book has me type out the following as part of a class method:


+(id)randomPossession
{
    //create an array of three adjectives
    NSArray *randomAdjectiveList = [NSArray arrayWithObjects:@"Fluffy", "Rusty", "Shiny", nil];

    //create an array of three nouns
    NSArray *randomNounList = [NSArray arrayWithObjects:@"Bear", "Spork", "Mac", nil];

but for those two arrays, I get the EXC_BAD_ACCESS issue at runtime, and the analyzer seems to point to them as the problem, saying "Argument to 'NSArray' method 'arrayWithObjects:' should be an Objective-C pointer type, not 'char *'. It's late, which isn't helping, but I'm stumped. Any ideas? (This is kind of similar to stuff I've done before in the other book, but at least this way I'm getting a much better understanding of why things are (not) happening.)

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
You forgot the @ in front of the strings.

+(id)randomPossession
{
//create an array of three adjectives
NSArray *randomAdjectiveList = [NSArray arrayWithObjects:@"Fluffy", @"Rusty", @"Shiny", nil];

//create an array of three nouns
NSArray *randomNounList = [NSArray arrayWithObjects:@"Bear", @"Spork", @"Mac", nil];
...
}

"" is a char* (C) string, @"" is an (Objective-C) NSString, and NSArray only handles Objective-C objects.

double sulk
Jul 2, 2010

Whoops, I'm dumb.

Edit: It's giving me other troubles now, but just some missing info which is probably my fault somehow. At least it's running otherwise.

double sulk fucked around with this message at 08:59 on Oct 24, 2011

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

I have a question about breakpoint debugging in Xcode: how do you deal with it taking you through all the assembler code? Is there a way to disable that? I've had it happen frequently enough that it makes breakpoint debugging more difficult than other methods, and certainly more difficult than in other languages.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Pretty sure that happens when and only when the source for the function it's stepping through is unavailable (e.g. Apple frameworks), or obviously if the function itself is written in assembler (e.g. objc_msgSend). Does the breakpoint jump directly to some assembler, or are you stepping into function calls to reach it? If the latter, just step back out and then step over. If the former (e.g. maybe it's an exception breakpoint and objc_msgSend is at the top of the call stack), find the frames of the call stack with your code and look through that.

Adbot
ADBOT LOVES YOU

frogbs
May 5, 2004
Well well well
So i'm just starting to explorer the idea of developing an iPhone game. I'm looking to start by using some sort of pre-made 2d game engine with physics. Is cocos2d still my best bet? Should I be using the unstable 2.0 branch?

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