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
Carthag Tuek
Oct 15, 2005

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



rjmccall posted:

If you make a macro around ivar_getOffset, it'll work for an arbitrary type.

The more I thought about it, the more I realized it's just my really prissy sense of "pretty code" that's getting in there. As long as they're documented I guess double-casts aren't bad. Cause that was like my main issue, that I had to cast to void and then to brigded id. But each cast makes sense cause I'm pulling this strange YES constant in from outside so yeah.

ffs a pagebreak really?

Adbot
ADBOT LOVES YOU

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Snapchat A Titty posted:

The more I thought about it, the more I realized it's just my really prissy sense of "pretty code" that's getting in there. As long as they're documented I guess double-casts aren't bad. Cause that was like my main issue, that I had to cast to void and then to brigded id. But each cast makes sense cause I'm pulling this strange YES constant in from outside so yeah.

ffs a pagebreak really?

That call is one of those unique snowflakes where a bunch of void casting BS is perfectly reasonable.

zero knowledge
Apr 27, 2008
Besides, isn't it a little late to worry about how pretty the code is? I mean, you're setting the value of an ivar of some object using the runtime, and it's casting through void * that seems gross to you?

It's kind of like NSInvocation: passing the index of an argument to -[NSInvocation getArgument:atIndex:], and remembering that indices 0 and 1 are self and _cmd respectively is pretty fragile and makes me uneasy, but hey, if you're using NSInvocation, you probably gave up on "pretty code" a long time ago.

Modern Pragmatist
Aug 20, 2008
I was thinking that I would develop an iOS app that would be a really simple point-of-interest app. It would be somewhat similar to Yelp's layout in that it would have a map with POIs shown in the area along with descriptions (if clicked), basic ratings / comments etc. It seems like this is an extremely common type of interface and before I try to reinvent the wheel on this, is there a framework that can provide a lot of this basic functionality to where I really just need to plugin my own custom locations and descriptions?

Doc Block
Apr 15, 2003
Fun Shoe
I've never used it, but I imagine MapKit or whatever it's called is what you're looking for, and best of all it's built into iOS.

slogula
Oct 2, 2013

Malloreon posted:

I would read Kochan's book on objective-c, then Big Nerd Ranch + CS193P from stanford.

Awesome. Thank you.

lord funk
Feb 16, 2004

Nonstop objc_object::release() EXC_BAD_ACCESS all this week. Just a train of them.

edit:

let cArrayManagement = "suck"

lord funk fucked around with this message at 01:29 on Aug 19, 2014

Doctor w-rw-rw-
Jun 24, 2008

lord funk posted:

Nonstop objc_object::release() EXC_BAD_ACCESS all this week. Just a train of them.

Have you tried turning on NSObject zombies?

lord funk
Feb 16, 2004

Doctor w-rw-rw- posted:

Have you tried turning on NSObject zombies?

It's always C arrays with me. This time it was a range check typo.

Doctor w-rw-rw-
Jun 24, 2008

lord funk posted:

It's always C arrays with me. This time it was a range check typo.

Please don't tell me you're using C arrays with NSObjects. You're not, right?

lord funk
Feb 16, 2004

Doctor w-rw-rw- posted:

Please don't tell me you're using C arrays with NSObjects. You're not, right?

No. I keep track of values that change constantly to help with data thinning, so it was just an array of doubles. I was writing to index -1, which is why objects were getting garbled.

lord funk
Feb 16, 2004

Oh hooray new rotation implementation for iOS 8! Let's keep this party going!

Doc Block
Apr 15, 2003
Fun Shoe
Something weird happened - I got a crash report for an app that hasn't been released yet, on a device type that I don't own.

But my app's status in iTunes Connect says Waiting For Review. And I only submitted it on Sunday.

:ninja:

bumnuts
Dec 10, 2004
mmm...crunchy

Doc Block posted:

Something weird happened - I got a crash report for an app that hasn't been released yet, on a device type that I don't own.

But my app's status in iTunes Connect says Waiting For Review. And I only submitted it on Sunday.

:ninja:

What crash reporting tool are you using? I'm in the market for a new one.

Doc Block
Apr 15, 2003
Fun Shoe
Crashlytics.

edit: the worst part is, the crash isn't in my code, it's in Cocos2D, in the glSwapBuffers code. Looks like it might be an OS bug.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Doc Block posted:

Something weird happened - I got a crash report for an app that hasn't been released yet, on a device type that I don't own.

But my app's status in iTunes Connect says Waiting For Review. And I only submitted it on Sunday.

:ninja:

Crashes during Apple's testing?

Doc Block
Apr 15, 2003
Fun Shoe
Yeah, but it doesn't say that it's In Review.

Anyway, it looks like the crash is from Cocos2D trying to draw while the app is in the background :argh:

It's happened 4 times according to Crashlytics, twice on iPad Mini and twice on iPad Air.

edit: it's probably an issue where Cocos2D doesn't stop drawing soon enough when the app gets backgrounded on certain devices.

Doc Block fucked around with this message at 18:35 on Aug 19, 2014

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

lord funk posted:

Oh hooray new rotation implementation for iOS 8! Let's keep this party going!

What subtle issues will be present in this iteration?!? Stay tuned!

lord funk
Feb 16, 2004

ultramiraculous posted:

What subtle issues will be present in this iteration?!? Stay tuned!

viewWillTransitionToSize:withTransitionCoordinator: NS_DEPRECATED_IOS(9_0)

viewWillMoveToCoordinator:completionMagician: NS_DEPRECATED_IOS(10_0)

willRotateTowardsMecca:timeOfDay: NS_DEPRECATED_IOS(11_0)

haveblue
Aug 15, 2005



Toilet Rascal
viewWillTranslateToX:Y:Z:Kata:

UraniumAnchor
May 21, 2006

Not a walrus.
These are almost more OpenGL thread questions but it's only occuring on iOS, so I figured I'd ask here too.

Firstly, I have some skeletal vertex shader code that is flickering the triangles whenever something moves. It looks as if the culling is suddenly backwards, but I have culling turned off and it's still occurring. The vertex data is contained in static VBOs that are specified once and never change, so I really doubt it's a matter of the vertex data itself getting overwritten, either. The triangles attached to bones that don't move in a given frame don't have this problem, and I'm reasonably sure the only thing changing frame to frame is the bone matrices and the overall clip matrix (and sometimes not even that, if I just leave a given object sitting in one spot, unmoving but animating). I doubt it's the shader, either, because I got identical (so far as I could tell, anyway) results when I switched the shader off and used CPU-side bone calculations instead.

The part that has me most confused is that this is ONLY occurring so far on iOS 7.x devices (tested an iPad 2, iPad 3, and iPod Touch 5). The same code displays correctly on Android, OSX, Windows, iOS 5.x (I don't have any iOS 6 or 8 devices to test so I don't know on that either way), and the iOS simulator.

Secondly, the same overall code base, on iOS 5, is stalling out pretty badly. According to the Instruments tool it's losing a lot of time in glInvalidateFramebuffer (about 6ms per frame), which is a function I'm not even calling directly, so I figure it must be part of the frame blit, and maybe it just thinks the function is stalling because that's where it's actually doing all of the command flushes. No other per-frame operations are taking any significant length of time, everything else in the top 10 in terms of "average time consumed" is one-off things like texture loads. This is happening on an iPad 3 with 5.5.1, and NOT an iPad 3 with 7.x, so I almost want to think it's an OS/Driver problem. But that doesn't really help me fix the issue since I don't really want to require people to update past 5 just to fix a weird performance problem that shouldn't even be occurring.

Anybody have any ideas on how to solve/investigate either one of these problems?

UraniumAnchor fucked around with this message at 06:23 on Aug 20, 2014

Doctor w-rw-rw-
Jun 24, 2008
Abandon support for the iPad 3. I had one. It has, by far, the worst fill rate of all iOS devices, because it was the first retina iPad, before the GPUs caught up. It's so bad that of the four levels of iOS fill rate performance that Facebook tracks, they name the iPad 3's fill rate "abysmal". It's not worth supporting,on any iOS version.

I'm not too knowledgeable about OpenGL, but I'd check to make sure you're not copying a ton of pixels out to the rest of your application on every frame, as taking pixels from OpenGL contexts can be expensive. Maybe check https://developer.apple.com/library...0008793-CH6-SW3

Doctor w-rw-rw- fucked around with this message at 18:00 on Aug 20, 2014

Doc Block
Apr 15, 2003
Fun Shoe
Maybe check for glDiscardFramebuffer support (or whatever it's called) and see if using it helps with the long frame buffer switch?

Also, is iOS 5 support really worth it? iOS 5 users are less than 1% of users, so IMHO if it takes more than 1% of your time it's not worth it. Especially if you have to mess with old versions of Xcode.

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.
Call glGetError() after every gl* call and see if it's failing anywhere on your working and your non-working devices. I use this macro:

code:
#if defined(DEBUG)
	#import <unistd.h>
	#import <signal.h>
	
	#define glCheckError() { \
		GLenum err = glGetError(); \
		if (err != GL_NO_ERROR) { \
			NSLog(@"OpenGL error: 0x%x in %s (%s:%d)", err, __PRETTY_FUNCTION__, __FILE__, __LINE__); \
			kill(getpid(), SIGINT); \
		} \
	} \
#else
	#define glCheckError()
#endif
I just call glCheckError() after every gl* call and if something generates an error, I'll know right away and it'll break into the debugger.

Once I got my 5S, my applications were acting funny so I had to check GL errors to see what was happening, I can't for the life of me remember what my fix was though. It might have been about unbinding array buffers at the end of each frame or something - something to do with resetting a binding back to 0.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Just to make sure my hopes are appropriately suppressed, Xcode extensibility is nil, right?

Doc Block
Apr 15, 2003
Fun Shoe
It can be done, but I'm not aware of any thriving Xcode plugin market.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
I mean there's some pretty good stuff on Alcatraz. I recommend the button to nuke your DerivedData.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

I'm thinking about things like editor extensions and support for DSLs, but I'll check that stuff out.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Since Xcode is written in obj-c and plugins run in-process you can in theory swizzle anything you want. Have fun reverse-engineering things definitely not intended to be a public API, though (and repeating that every year).

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.

ultramiraculous posted:

I mean there's some pretty good stuff on Alcatraz. I recommend the button to nuke your DerivedData.
That's not as satisfying as opening terminal and typing "fuxcode". Everyone needs an fuxcode script.

Doctor w-rw-rw-
Jun 24, 2008

Subjunctive posted:

I'm thinking about things like editor extensions and support for DSLs, but I'll check that stuff out.

http://chen.do/blog/2013/10/22/reverse-engineering-xcode-with-dtrace/

Enjoy.

Doc Block
Apr 15, 2003
Fun Shoe

ManicJason posted:

That's not as satisfying as opening terminal and typing "fuxcode". Everyone needs an fuxcode script.

seriously.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I'm boring and just type derivedata, up, enter.

This very occasionally causes problems.

Doctor w-rw-rw-
Jun 24, 2008

Plorkyeran posted:

I'm boring and just type derivedata, up, enter.

This very occasionally causes problems.

Even easier: <Ctrl-R>der<enter>

Subjunctive
Sep 12, 2006

✨sparkle and shine✨


Thanks...I think.

Doc Block
Apr 15, 2003
Fun Shoe
I found the cause of the crash that Apple was seeing in my game. Turns out that Cocos2D doesn't stop rendering when you switch away from the app if there's a modal viewcontroller displayed, such as the GameCenter login screen. And your app's OpenGL context is invalid while the app is backgrounded, so trying to do any OpenGL stuff results in a crash.

Instead of just stopping the renderer when the app gets backgrounded, Cocos2D specifically checks to see if it's the top view controller when the app goes to the background and only stops rendering if the answer is YES.
Objective-C code:
// In Cocos2D's convenience AppDelegate subclass that your game subclasses
-(void) applicationDidEnterBackground:(UIApplication*)application
{
	if( [navController_ visibleViewController] == [CCDirector sharedDirector] )
		[[CCDirector sharedDirector] stopAnimation];
}
Can anyone think of why this would be a good idea?

Doc Block fucked around with this message at 06:17 on Aug 21, 2014

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Doc Block posted:

I found the cause of the crash that Apple was seeing in my game. Turns out that Cocos2D doesn't stop rendering when you switch away from the app if there's a modal viewcontroller displayed, such as the GameCenter login screen. And your app's OpenGL context is invalid while the app is backgrounded, so trying to do any OpenGL stuff results in a crash.

Instead of just stopping the renderer when the app gets backgrounded, Cocos2D specifically checks to see if it's the top view controller when the app goes to the background and only stops rendering if the answer is YES.
Objective-C code:
// In Cocos2D's convenience AppDelegate subclass that your game subclasses
-(void) applicationDidEnterBackground:(UIApplication*)application
{
	if( [navController_ visibleViewController] == [CCDirector sharedDirector] )
		[[CCDirector sharedDirector] stopAnimation];
}
Can anyone think of why this would be a good idea?

I'd check the commit/blame logs in the off chance it was a fix for something specific and there's a reasonable comment about it...but I can't think of a reason this would be a good idea. It seems like engine should be paused on backgrounding, especially if it's not even the primary view.

Doc Block
Apr 15, 2003
Fun Shoe

ultramiraculous posted:

I'd check the commit/blame logs in the off chance it was a fix for something specific and there's a reasonable comment about it...but I can't think of a reason this would be a good idea. It seems like engine should be paused on backgrounding, especially if it's not even the primary view.

I checked and the file is exactly how it was when it was first committed last year. The commit message was just "Adds initial version of CCAppDelegate for easier setup".

So I think I'm gonna do a pull request that fixes it.

mrbass21
Feb 1, 2009
I'm new to CoreData and I've run into a problem creating my model that I'm not sure how to configure.


I have two objects in my graph:

File
Server



I get a list of all available servers, and create a server object for each one.

Later I get a list of files, and each file has multiple servers it can exist on.

So assume I have Server 1, Server 2, Server 3, Server 4. File 1 can exist on Servers 1, 3, 4.

I don't really care about an inverse relationship (I.E. being able to pick a server and tell what files are on it). I only care about the File having a property that links to the appropriate server list that it exists on.

How do I set this up in my object graph in CoreData?

I looked at a unidirectional relationship, but Apple seemed to encourage you to never use them. Is that the right way to go?

Adbot
ADBOT LOVES YOU

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

mrbass21 posted:

I'm new to CoreData and I've run into a problem creating my model that I'm not sure how to configure.


I have two objects in my graph:

File
Server



I get a list of all available servers, and create a server object for each one.

Later I get a list of files, and each file has multiple servers it can exist on.

So assume I have Server 1, Server 2, Server 3, Server 4. File 1 can exist on Servers 1, 3, 4.

I don't really care about an inverse relationship (I.E. being able to pick a server and tell what files are on it). I only care about the File having a property that links to the appropriate server list that it exists on.

How do I set this up in my object graph in CoreData?

I looked at a unidirectional relationship, but Apple seemed to encourage you to never use them. Is that the right way to go?

I use them and turn off the idiotic warnings Xcode likes to spit out about a missing inverse relationship. Don't worry about it.

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