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
Fate Accomplice
Nov 30, 2006




Provisioning question!

I develop on my work machine, user name <originalname>. I had my provisioning cert all set up, keychain working, etc. There was a work migration to a new domain, and IT changed my user name (same account) to <newname>.

I created a new app post migration and created an app id in the developer portal, added the provisioning profile to my keychain, but the organizer is giving me an error, "Xcode cannot find a valid private-key/certificate pair for this profile in your keychain"

How do I fix this? revoke my previous provisioning profile and redo the process?

EDIT: ALSO! in the simulator, if I run my app, tap the home button, double tap it, and close my app from the fast app switcher, the simulator crashes. Is this a simulator thing, or did I not implement something I should have?

Fate Accomplice fucked around with this message at 22:53 on Dec 17, 2011

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Xcode can't find the certificate you used to create the provisioning profile, so you can either retrieve that key or cut a new provisioning profile.

As for the simulator thing, can you tell if it's crashing in your app? Make sure you've enabled breakpoints on exceptions, maybe check the console for messages. I haven't encountered that issue with the simulator that wasn't caused by my app.

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
There are some issues with the simulator in Lion that weren't there before. For example the thing just straight up crashes if you don't disable all typing tools (auto-punctuation, spell check, etc) when typing into text fields. Hopefully they get that sorted out quick because gently caress the two hours I spent thinking there was something wrong with my app before finding out the simulator is just busted.

duck pond
Sep 13, 2007

Say, is anybody out there familiar with any computational geometry libs that play nicely with Xcode? Thought I'd try to use CGAL but getting it set up is currently beyond my capabilities :/

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
edit: My original question doesn't make a terrible amount of sense, because I'm still missing something.

Here's what I know

  • OSX app without ARC enabled
  • Heavy use of Core Animation including HD PNGs
  • Heavy use of NSTimers
  • memory usage in the Activity Monitor climbs steadily, with the computer being basically unusable once it fills up the RAM in an hour or so
  • no leaks found with the Leaks tool, and I'm 99% sure I have no CGColor/Colorspace/Imageref leaks that would be missed by Leaks
  • The Allocations tool shows memory usage bouncing around between 40 and 120 megs without a net growth


edit again: Circular references ahoy. I still have no idea where they're coming from, but I'm pretty sure I found a CALayer that is not getting fully released.

final edit: I found a layer very high up in my layer hierarchy that did not call [super dealloc] in its dealloc. :suicide:

ManicJason fucked around with this message at 00:56 on Dec 21, 2011

Khelmar
Oct 12, 2003

Things fix me.
I'm really new to Objective C, and I'm having an issue with a piece of code I'm trying to write. I'm trying to read a file into a string, and then parse it as a CSV file.

If I use this code:
code:
        NSString *ImportFileName = [NSString stringWithFormat:@"%@/%@", documentsDirectory, rowValue];

        NSStringEncoding *enc;
        NSError *err;
       
        NSLog(@"%@", ImportFileName);
       
        NSLog(@"About to crash...");
        
        NSString *CSVFile = [NSString stringWithContentsOfFile:ImportFileName usedEncoding: enc error: &err];
I get EXC_BAD_ACCESS on the CSVFile line. If I use this:

code:
        NSString *ImportFileName = [NSString stringWithFormat:@"%@/%@", documentsDirectory, rowValue];

        NSLog(@"%@", ImportFileName);
       
        NSLog(@"About to crash...");
        
        NSString *CSVFile = [NSString stringWithContentsOfFile:ImportFileName];
it works just fine, although I get the warning that stringWithContentsOfFile is depreciated. I feel like this has to be something obvious, but I've been beating my head against the wall for hours and can't find it. Any suggestions?

Kekekela
Oct 28, 2004

Khelmar posted:

I'm really new to Objective C, and I'm having an issue with a piece of code I'm trying to write. I'm trying to read a file into a string, and then parse it as a CSV file.

If I use this code:
code:
        NSString *ImportFileName = [NSString stringWithFormat:@"%@/%@", documentsDirectory, rowValue];

        NSStringEncoding *enc;
        NSError *err;
       
        NSLog(@"%@", ImportFileName);
       
        NSLog(@"About to crash...");
        
        NSString *CSVFile = [NSString stringWithContentsOfFile:ImportFileName usedEncoding: enc error: &err];
I get EXC_BAD_ACCESS on the CSVFile line. If I use this:

code:
        NSString *ImportFileName = [NSString stringWithFormat:@"%@/%@", documentsDirectory, rowValue];

        NSLog(@"%@", ImportFileName);
       
        NSLog(@"About to crash...");
        
        NSString *CSVFile = [NSString stringWithContentsOfFile:ImportFileName];
it works just fine, although I get the warning that stringWithContentsOfFile is depreciated. I feel like this has to be something obvious, but I've been beating my head against the wall for hours and can't find it. Any suggestions?

Why are you using the & operator on err? I didn't think this was typically used in obj C. What happens if you remove it?

OHIO
Aug 15, 2005

touchin' algebra
You need to specify an NSStringEncoding like 'NSUTF8StringEncoding'. Here's a list at the bottom.

Khelmar
Oct 12, 2003

Things fix me.

Kekekela posted:

Why are you using the & operator on err? I didn't think this was typically used in obj C. What happens if you remove it?

I get:

error: Automatic Reference Counting Issue: Implicit conversion of an Objective-C pointer to 'NSError *__autoreleasing *' is disallowed with ARC

Strangely, if I put "&" in front of BOTH enc and err, it works fine, although I get a warning:

warning: Semantic Issue: Incompatible pointer types sending 'NSStringEncoding **' (aka 'unsigned int **') to parameter of type 'NSStringEncoding *' (aka 'unsigned int *')

And I thought usedEncoding meant ObjC would figure out the encoding and then return it to the enc variable (per the NSString reference).

Kekekela
Oct 28, 2004

quote:

NSStringEncoding *enc;

I think you don't need * there since its an integer. (which would seem to my novice eye to make sense with the error you're getting)

Zhentar
Sep 28, 2003

Brilliant Master Genius

Kekekela posted:

I think you don't need * there since its an integer. (which would seem to my novice eye to make sense with the error you're getting)

Bingo (and then you do need to use the & with both parameters). The parameter there is asking for the address of an NSStringEncoding variable that it can modify. You're giving it an uninitialized pointer, so rather than pointing at an NSStringEncoding it can modify, you're just giving it a random memory address. You get the EXC_BAD_ACCESS because that random memory address doesn't happen to point to allocated memory.

OHIO
Aug 15, 2005

touchin' algebra

Khelmar posted:

And I thought usedEncoding meant ObjC would figure out the encoding and then return it to the enc variable (per the NSString reference).

Wow you're right, I'm dumb, sorry.

Khelmar
Oct 12, 2003

Things fix me.
Thanks - that sort of makes sense. I thought the declaration also initialized it, and that all the ObjC types (NS*) needed to be pointer types, which is wrong.

Steep learning curve continues!

Thanks for all the help!

zero knowledge
Apr 27, 2008

Khelmar posted:

Thanks - that sort of makes sense. I thought the declaration also initialized it,

This is only true of static and global variables (and I think instance variables in Objective-C objects). Otherwise, uninitialized variables have undefined values, as in, whatever the compiler and runtime feel like putting there, and the compiler makes no guarantees about the value so you should never rely on it. For pointer variables especially, it's a good idea to initialize variables to at least nil just so that you don't attempt to dereference a garbage pointer later on.

quote:

and that all the ObjC types (NS*) needed to be pointer types, which is wrong.

This is true of all objects, but not every type prefixed by NS is an object--it just means it's a symbol vended by Foundation and since ObjC lacks namespaces, they put that prefix there to avoid collisions with symbols defined by other system frameworks or the client's own code.

Kekekela
Oct 28, 2004
Has anyone worked through assignment two of the current CS193p class?

I'm kind of confused conceptually on several things relating to the RPN calculator in general and the entry of variables as well.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Kekekela posted:

Has anyone worked through assignment two of the current CS193p class?

I'm kind of confused conceptually on several things relating to the RPN calculator in general and the entry of variables as well.

Where do you get the assignments? I am on lecture 13, but I'd love to do the homework. I assume it's somewhere obvious and I am am blind.

Kekekela
Oct 28, 2004

Lumpy posted:

Where do you get the assignments? I am on lecture 13, but I'd love to do the homework. I assume it's somewhere obvious and I am am blind.

http://www.stanford.edu/class/cs193p/cgi-bin/drupal/

Zhentar
Sep 28, 2003

Brilliant Master Genius
Are there any published ARC performance comparisons? I'm doing some investigation to convince my team to switch our project over to ARC, and it would be helpful if I had some measurements to address any concerns in that area.

Edit: has anyone else found the version of the static analyzer shipped with XCode 4.2 to give really poor results? Telling people "the compiler is smart enough to know when retain and release are needed!" would probably be a lot easier if the analyzer weren't giving us a hundred or so obviously incorrect memory management warnings

Zhentar fucked around with this message at 21:24 on Dec 23, 2011

zero knowledge
Apr 27, 2008
Both ARC and the static analyzer rely heavily on Foundation naming conventions to reason about ownership of objects returned from or passed into methods. Do you maybe have methods that have "new" or "create" in their names and don't return an owning reference to something, or maybe methods that *do* return a +1 reference and don't have those keywords in their name? You can also give the analyzer some hints using macros like NS_RETURNS_RETAINED or NS_CONSUMED on methods or parameters (http://clang-analyzer.llvm.org/annotations.html).

Zhentar
Sep 28, 2003

Brilliant Master Genius
I realized that all of the apparent "false" positives were calling [self.ivar release] rather than [ivar release]. They happen to be equivalent in these cases, but they aren't necessarily, so the analyzer is technically right, it's just confusing as to what the problem actually is.

stealth edit: and actually, the analyzer is at least a little clever about the naming conventions. I thoughtlessly added a couple properties that start with copy, and I just get a compiler warning about not respecting naming conventions, without any analyzer errors.

Zhentar fucked around with this message at 03:56 on Dec 24, 2011

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Zhentar posted:

I realized that all of the apparent "false" positives were calling [self.ivar release] rather than [ivar release]. They happen to be equivalent in these cases, but they aren't necessarily, so the analyzer is technically right, it's just confusing as to what the problem actually is.

It's expecting you to do either
code:
self.ivar = nil
(which will release the current value if the property is a retain one) or, as you have,
code:
[ivar release]
.

dizzywhip
Dec 23, 2005

I want to put a simple little video tutorial window into my Cocoa app, so I'm using QTMovieView from the QTKit framework. It works pretty well, except that the playback controls are the poo poo ones you used to see on QuickTime movies inside browsers a few OS revisions ago.

I'd like to instead have the nice floating controls that you see in QuickTime Player and iTunes, but I can't figure out if there's a way to get them without completely reconstructing them myself. I found one forum post saying that you need to recreate them, but I use an app that has built-in video tutorials and has the nice controls. They're identical to the QuickTime Player controls as far as I can tell, down to the glow you get when holding down the mouse on the buttons. I doubt they painstakingly recreated every detail of those controls just for some tutorial videos, but I guess it's possible.

Anyone have any experience with this?

Edit: Contacted the developer of that app and it turns out they did recreate it from scratch. Pretty lame, Apple should really be better about making standard UI elements available to everyone. I've already meticulously recreated the Safari tab bar, and I don't look forward to having to recreate this too for such a minor feature.

dizzywhip fucked around with this message at 06:39 on Dec 26, 2011

Bisse
Jun 26, 2005

Cross-posting from the Game Dev Megathread since you guys are prolly the best at this:

quote:

I'm wondering if it'd be possible to do a Win/OsX/Linux/iOS cross-platform game engine using C++ / OpenGL?

I'm looking to develop a simple 3D game (voxels! ) and, just for the sake of learning and experience, don't want to use any generic tool like Unity3D. Win/OsX/Linux should be banal - it's the iOS part i'm worried about. It all comes down to that is has to work with XCode and the iPhone has to handle it non-horribly.

How's the support for it if I do the engine with just mostly C++ standard libraries and GLUT? Any pitfalls I should look out for? Would I be better off doing this in C# or Objective C?
I'm aware i'll need to do some Objective C, but i'm thinking I shouldn't need to do much more than provide a rendering surface and input. My dream scenario would be to package the game as a library or DLL and then just write a bit of code to implement it on each platform.

Bisse fucked around with this message at 22:35 on Dec 25, 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

Bisse posted:

Cross-posting from the Game Dev Megathread since you guys are prolly the best at this:

I'm aware i'll need to do some Objective C, but i'm thinking I shouldn't need to do much more than provide a rendering surface and input. My dream scenario would be to package the game as a library or DLL and then just write a bit of code to implement it on each platform.

OpenGL ES, which is the only thing available on iOS, lacks some features of standard OpenGL. I'm no expert, but I think you should be able to do more or less what you're planning to do if you stick to OpenGL ES in the rendering code, which I'm fairly sure is a strict subset of OpenGL.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

PT6A posted:

OpenGL ES, which is the only thing available on iOS, lacks some features of standard OpenGL. I'm no expert, but I think you should be able to do more or less what you're planning to do if you stick to OpenGL ES in the rendering code, which I'm fairly sure is a strict subset of OpenGL.

Or stick with OpenGL and write some shims for OpenGL ES when you need them, similar to how OpenGL ES 2 implements OpenGL ES 1 on newer iOS devices.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
ManicJason: See, there are good reasons why ARC just does that for you automatically. :)

Zhentar posted:

Are there any published ARC performance comparisons? I'm doing some investigation to convince my team to switch our project over to ARC, and it would be helpful if I had some measurements to address any concerns in that area.

We have some internal data that I can't share, unfortunately. I can tell you that some people have seen respectable speedups, which honestly always surprises us, because we were really aiming for "not a significant performance regression". Apparently, insane amounts of stuff end up in the autorelease pool in a typical MRC program.

Zhentar posted:

Edit: has anyone else found the version of the static analyzer shipped with XCode 4.2 to give really poor results? Telling people "the compiler is smart enough to know when retain and release are needed!" would probably be a lot easier if the analyzer weren't giving us a hundred or so obviously incorrect memory management warnings

Just to be clear, ARC and the static analyzer use totally different approaches. The static analyzer tries to track the flow of data through your code and flag things that it feels confident would be bugs if you were following the Cocoa conventions. It's kindof nice and fluffy to think of ARC as simply enforcing that analysis, i.e. inserting retains and releases where otherwise the static analyzer would warn. That could never actually work, though; the static analyzer is heuristic and intraprocedural, and all of its limitations (many of them inherent) would potentially turn into memory bugs. Instead, ARC emits code to enforce local rules like "this variable has an invariant of owning a +1 on the object it points to" and "we got a +1 value back, so we'd better release that at some point soon."

Releasing an ivar is a good example of a place where the static analyzer has no idea and just has to assume you know what you're doing.

Doc Block
Apr 15, 2003
Fun Shoe

Bisse posted:

Cross-posting from the Game Dev Megathread since you guys are prolly the best at this:

I'm aware i'll need to do some Objective C, but i'm thinking I shouldn't need to do much more than provide a rendering surface and input. My dream scenario would be to package the game as a library or DLL and then just write a bit of code to implement it on each platform.

In addition to what others have said, don't use GLUT. I don't think it's even available for iOS.

Small White Dragon
Nov 23, 2007

No relation.
So, rjmccall, when can we expect C1X support in Clang? :)

Toady
Jan 12, 2009

I have to admit that I'm disappointed that the language in the documentation makes it sound as if garbage collection won't see further development. In spite of its drawbacks, I enjoyed the simplified accessors and lack of bridging casts between Objective-C and plain C code.

lord funk
Feb 16, 2004

Does anyone know any tips / tricks for speeding up tableview scrolling? One of my views has a few UITableView subviews, and it is unholy how slowly they scroll on an iPad 1. (In other news: got an iPad 1 for development!)



I've tried setting the backgrounds to solid colors, that didn't do anything. Is there anything about the data source that I can tweak? Right now they're just immutable arrays of strings.

Zhentar
Sep 28, 2003

Brilliant Master Genius
Hot optimization tip: try profiling your code instead of blindly guessing what might be slow.

OHIO
Aug 15, 2005

touchin' algebra
Are you sure you're not recreating your cells every time? That's a huge performance hit.

Aka use "dequeueReusableCellWithIdentifier:"

lord funk
Feb 16, 2004

Thanks.

Zhentar posted:

Hot optimization tip: try profiling your code instead of blindly guessing what might be slow.

Yeah. Turns out I left an animation loop running when it should have been paused. :downs:

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Small White Dragon posted:

So, rjmccall, when can we expect C1X support in Clang? :)

Anything you're looking at in specific? Some things, e.g. _Atomic, are at least partially implemented in ToT and will therefore someday appear in a release near you. I haven't been following that standard very closely, I'll admit.

Toady posted:

I have to admit that I'm disappointed that the language in the documentation makes it sound as if garbage collection won't see further development. In spite of its drawbacks, I enjoyed the simplified accessors and lack of bridging casts between Objective-C and plain C code.

I can say that the need for pervasive bridging casts in ARC is a known problem that we want to work on.

Toady
Jan 12, 2009

rjmccall posted:

I can say that the need for pervasive bridging casts in ARC is a known problem that we want to work on.

I had a feeling that's the case. ARC is amazing technology for a first release, perhaps more polished than garbage collection was in 10.5.

dereekb
Nov 7, 2010

What do you mean "error"?
I've been having trouble with custom TableViewCells, or specifically, I'm not sure what I'm doing wrong:

What I've done:
= Storyboard/XIB
- "Style" set to Custom
- Set up the prototype cell in the Storyboard (Additionally, later in another XIB file with a different CellIdentifier name)
- Set the cell's Identifier
- Set the cell's class to the custom class created

= Code
- Create a class that extends TableViewCell
- Set up the "cellForRowAtIndexPath" delegate function to look like:

code:

static NSString *CellIdentifier = @"CustomCell";
    
	CustomViewCell *newCell = (CustomViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
	
	if (newCell == nil) {
		newCell = [[CustomViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
		newCell.frame = CGRectMake(0.0, 0.0, 320.0, 55);
	}
	
    // Configure the cell...
     etc.

    return newCell;
     
I've looked through all the examples that I can find, but I still haven't been able to get a custom cell to load...

Any ideas on what I've messed up, or what isn't being set properly? (Also, the code segment above obviously isn't loading the NIB; I apparently deleted the code I had originally because it didn't work...)

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
Is anyone else developing in flash CS5.1 for the iPhone?

duck monster
Dec 15, 2004

thegasman2000 posted:

Is anyone else developing in flash CS5.1 for the iPhone?

Hiss! boo!

Also, did apple relent on this?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Pretty sure Flash is ok as of a few months ago.

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

dereekb posted:

I've looked through all the examples that I can find, but I still haven't been able to get a custom cell to load...

Any ideas on what I've messed up, or what isn't being set properly? (Also, the code segment above obviously isn't loading the NIB; I apparently deleted the code I had originally because it didn't work...)

Did you set the table view's data source? Is your code even being called? Set a breakpoint and fire it up.

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