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
AlwaysWetID34
Mar 8, 2003
*shrug*
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

AlwaysWetID34 fucked around with this message at 17:28 on Jan 18, 2019

Adbot
ADBOT LOVES YOU

Doc Block
Apr 15, 2003
Fun Shoe

Campbell posted:

After first going up to the store, the app got pulled because of rule 3.3.2 against interpreted code. I'm kind of thinking that initially he was reading stuff at runtime, and then had to go and compile everything natively or something to get back on the store. The games folder then, being a relic of that original code. That doesn't answer anything about the emulator part though.

I'd love to know more about its architecture because it seems to do some pretty tricky stuff behind the scenes.

It was rejected initially because it had a BASIC interpreter that was user-facing (can't make apps that are basically SDKs for end users), and I think there was something about Apple not being sure if the developer had gotten permission from the owners of the games he was including, and the developer threw a huge hissy fit and whined about evil Apple all over the tech news sites.

Then the developer "removed" the BASIC interpreter and licensed the games he was including, which finally got the app onto the app store, until somebody discovered that the BASIC interpreter was still there as an easter egg and could still be accessed if you knew how, so Apple pulled the app.

Then they removed the BASIC interpreter for real and got back onto the app store.

From what I can recall the whole "no interpreted code" thing didn't enter into it too much. Many of the rules get relaxed for games, and many "classic" games were literally just a dumped ROM and an emulator. Never mind that Angry Birds uses Lua extensively, and it came out long before the ban on interpreted code was lifted.

Doc Block
Apr 15, 2003
Fun Shoe

McFunkerson posted:

I'm smashing my head against a wall trying to get a subview to draw and I just don't understand what I'm doing wrong.

I have subclassed NSView and have a subview I am trying to draw in that view. I know the subview works fine because if I do:
code:
-(void) drawRect: (NSRect)dirtyRect
{
    rect.size.width = 832;
    rect.size.height = 120;
    NSPoint point = { 0, 0 };
    rect.origin = point;
    TabloidProgressView *newJob = [[TabloidProgressView alloc] initWithFrame:rect];
    [self addSubview:newJob];
{
it works fine. However what I'm trying to do is use an NSOperation to send notifications to my NSView to add in a subview. So I have something that looks like this:

code:
-(void) newJobNotification: (NSNotification *) notification
{
    ++jobCount;
        rect.size.width = 832;
        rect.size.height = 120;
        NSPoint point = { 0, ((jobCount *120) - 120) };
        rect.origin = point;
        TabloidProgressView *newJob = [[TabloidProgressView alloc] initWithFrame:rect];
        
        [self addSubview:newJob];

        NSLog(@"Notification Count %i", [[self subviews] count]);
    }
}
code:
- (void)drawRect:(NSRect)dirtyRect
{
    NSLog(@"Draw Count %i", [[self subviews] count]);
}
When this runs, nothing visually happens. My subview count in the notification is 1 like I'd expect, but in drawRect: it's 0. I can actually add a job with the GUI, get a subview count on 1 in the notification, then get a 0 in the drawRect: and then add a second job and get a 2 in the notification. WTF isn't drawRect: seeing my subviews?

I don't know much about OS X programming yet, but maybe try [self setNeedsDisplay:YES] once you add the new subview?

Also, unless your app is garbage collected, you need to release newJob after the addSubview call (NSView retains its subviews).

edit: and unless you're doing custom drawing, you don't need to implement drawRect:. In fact, your custom drawRect: is keeping the NSView class's drawRect: from being called, so if you're just testing try adding [super drawRect:dirtyRect] after the NSLog() call in your drawRect:

Doc Block fucked around with this message at 18:49 on Jul 13, 2011

AlwaysWetID34
Mar 8, 2003
*shrug*
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

AlwaysWetID34 fucked around with this message at 17:28 on Jan 18, 2019

Campbell
Jun 7, 2000

Doc Block posted:

It was rejected initially because ...

That's great info! Both it and Angry Birds only use LUA/game code that's compiled into the binary though and not downloaded right?

While I get content management for things like images/themes/whatever, the idea of downloading totally new logic and executing it makes my head hurt.

Doc Block
Apr 15, 2003
Fun Shoe
It's not compiled into the binary, but it is in the app bundle. Open up the IPA and see, from what I can recall there are a bunch of .lua files (of course, they've been compiled to bytecode with the lua compiler, so you can't read them).

Conceptually, downloading new game logic and executing it isn't that big of a deal, assuming the new logic is in an interpreted language. You just download it like you would any other file, then have your app's built-in Lua interpreter run it when needed.

AlwaysWetID34
Mar 8, 2003
*shrug*
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

AlwaysWetID34 fucked around with this message at 18:00 on Jan 18, 2019

Doc Block
Apr 15, 2003
Fun Shoe
Use the diff viewer or whatever it's called and see what changed.

CeciPipePasPipe
Aug 18, 2004
This pipe not pipe!!

Doc Block posted:

Conceptually, downloading new game logic and executing it isn't that big of a deal, assuming the new logic is in an interpreted language. You just download it like you would any other file, then have your app's built-in Lua interpreter run it when needed.

Yes, unfortunately I believe this is still disallowed by Apple. Any scripts you intend to run through an interpreter of any kind must already be embedded, I think. (This is probably why the C64 app seem to contain all the games in the main .ipa already)

(Otherwise, creating a web browser with flash support would be legal.)

(Also you could then easily create some kind of alternate app store where you sell games written in Lua)

(The Opera Mini browser even runs JavaScript on the server, to dodge this restriction, I believe).

Now, whether Apple actually checks to see if your app is capable of downloading and interpreting LUA scripts (for example, via a content update) is a completely different story. But I wouldn't risk it. Even though it would be a very useful mechanism.

Doc Block
Apr 15, 2003
Fun Shoe
Yeah, sorry, I wasn't trying to imply that downloading new code was allowed. I was just responding to Campbell's comment about downloading new code hurting his head, just that conceptually it isn't that hard (for interpreted languages, anyway).

shodanjr_gr
Nov 20, 2007
What are the open-source/free game engine options for iOS right now?

I prefer OS since I'd like to have access to the graphics engine source code for modification but it is not a strict necessity.

Mikey-San
Nov 3, 2005

I'm Edith Head!

McFunkerson posted:

I'm smashing my head against a wall trying to get a subview to draw and I just don't understand what I'm doing wrong.

I have subclassed NSView and have a subview I am trying to draw in that view. I know the subview works fine because if I do:
code:
-(void) drawRect: (NSRect)dirtyRect
{
    rect.size.width = 832;
    rect.size.height = 120;
    NSPoint point = { 0, 0 };
    rect.origin = point;
    TabloidProgressView *newJob = [[TabloidProgressView alloc] initWithFrame:rect];
    [self addSubview:newJob];
{

You should not add subviews in -drawRect: methods. This is not how the AppKit view drawing model is intended to work, and you will suffer performance penalties (and who knows how many other problems) by doing it. (Also, you're leaking a TabloidProgressView every single time you draw.)

If you want a view to be drawn, it should exist in your view hierarchy prior to the view attempting to draw itself.

Mikey-San
Nov 3, 2005

I'm Edith Head!
Here's the documentation you should read:

Introduction to View Programming Guide for Cocoa

Toady
Jan 12, 2009

McFunkerson posted:

it works fine. However what I'm trying to do is use an NSOperation to send notifications to my NSView to add in a subview. So I have something that looks like this:

Are you sending the notification on the view's thread (i.e., the main thread)? Incidentally, I'd have a controller be responsible for listening to notifications and adding the subviews, not the view itself.

Toady fucked around with this message at 06:32 on Jul 14, 2011

xelfer
Nov 27, 2007

What's new, Buseycat? woa-aah, woa-aah, woa-aah

shodanjr_gr posted:

What are the open-source/free game engine options for iOS right now?

I prefer OS since I'd like to have access to the graphics engine source code for modification but it is not a strict necessity.

http://www.cocos2d-iphone.org/

oh look, 1.0.0 came out yesterday, awesome :)

edit: sorry, this is a framework, is that what you're after or you want something like http://www.garagegames.com/products/torque-2d/iphone ?

shodanjr_gr
Nov 20, 2007

xelfer posted:

http://www.cocos2d-iphone.org/

oh look, 1.0.0 came out yesterday, awesome :)

edit: sorry, this is a framework, is that what you're after or you want something like http://www.garagegames.com/products/torque-2d/iphone ?

Optimally I'd be looking for something along the lines of Unity but, you know, free...and also not limited to 2D.

Doc Block
Apr 15, 2003
Fun Shoe
Does the Torque3D engine still have an iPhone port? If so you can try that. It isn't open source, but you do get the source code.

stray
Jun 28, 2005

"It's a jet pack, Michael. What could possibly go wrong?"
Anyone know how Yelp might have created this neat toolbar that expands when you tap on it?

Pic: expanded toolbar.

Doc Block
Apr 15, 2003
Fun Shoe
Looks like it's just a view with text fields that animates out from underneath the toolbar. So when you tap the toolbar's search field, it brings out the other view.

SmirkingJack
Nov 27, 2002
I am working my way through Learn Cocoa on the Mac which was written based on Xcode 3, and I am using 4. So far I have been able to fairly easily find my way around the differences, but I am on a chapter introducing Core Data and there's a part being able to automatically generate a GUI by Option+dragging from an entity to a window in IB, but I don't seem to be able to do this in Xcode 4. Is it still possible, or did that ability die with v3? And more importantly, how do I do this?

Thanks!

Edit: This are the instructions in the book:

Start by going back to Xcode’s navigation pane. Go into the Resources group and double-click MainMenu.xib to open it in Interface Builder. This brings up a nib file much like you’ve seen in earlier, including a menu and an empty window. Bring the empty window to the front (double-click on its icon in the main window if the window isn’t showing), and make it a bit bigger; somewhere about 500 x 600 will do nicely.
Now go back to Xcode, and bring up your model file if it isn’t still showing. What you’re going to do is ⌥-drag the MythicalPerson entity from the graph paper workspace over to the blank window in Interface Builder. Start by holding down ⌥, then click and hold on the box representing the MythicalPerson entity. Keep holding the mouse and drag away, and you’ll see a translucent copy of the entity box being pulled along with your mouse pointer. Once the drag is started, you can release the ⌥ button. Now drag the entity over the empty window in Interface Builder. If you can’t see it, use ⌘Tab to switch back to Interface Builder (while still holding down the mouse button!), drag over the middle of the empty window, and release the mouse button.
Now you’ll be presented with the New Core Data Entity Interface assistant

SmirkingJack fucked around with this message at 17:57 on Jul 15, 2011

lord funk
Feb 16, 2004

Does it bum anyone else out that there isn't a good Number Pad keyboard mode for the iPad? I really don't want to give in and roll my own, but my god, the full keyboard takes up sooooo much space. :(

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

lord funk posted:

Does it bum anyone else out that there isn't a good Number Pad keyboard mode for the iPad? I really don't want to give in and roll my own, but my god, the full keyboard takes up sooooo much space. :(

Is there something wrong with UIKeyboardTypeNumberPad?



EDIT: vv Ahh, that'll teach me to skip over the important words in the post.

Flobbster fucked around with this message at 00:38 on Jul 16, 2011

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Flobbster posted:

Is there something wrong with UIKeyboardTypeNumberPad?

On the iPad it's the full keyboard set to the mode that has numbers on one row, so you get a bunch of other poo poo alongside the numbers.

lord funk
Feb 16, 2004

I've got a view updating problem. I have a method in my view's delegate that updates some slider colors, which works as expected (the user interacts with the interface, the other sliders update to reflect the change).

But I also want that view to follow a value through key-value observing. I set up the KVO in the view controller (the view's delegate) and it follows the value perfectly. So I pass that value to the method, but the view doesn't update.

I thought I might need [UIView setNeedsDisplay], but I've put that everywhere I can think and still nothing. Why is calling the method with KVO different than calling it with a user interaction?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

lord funk posted:

I've got a view updating problem. I have a method in my view's delegate that updates some slider colors, which works as expected (the user interacts with the interface, the other sliders update to reflect the change).

Post some code.

lord funk
Feb 16, 2004

The view's (called SEQView) methods that updates the start position, and the one that sets the background colors for a group of UISliders:

code:
//in SEQView.m

- (void)setSeqStartPosition:(int)startIndex {
    _seqStartPosition = startIndex;
}

- (void)updateSeqRangeDisplay {
    //update slider backgrounds
    [UIView beginAnimations:@"replaceSlidersForNewBank" context:nil];
    [UIView setAnimationDuration:0.0];
    for (int i=0; i<16; i++) {
        int seqIndex = (_currentBank * 16) + i;
        if (seqIndex < (_seqLength + _seqStartPosition) &&
            seqIndex >= _seqStartPosition) {
            TCSlider *slider = [_seqSliders objectAtIndex:i];
            [slider setBackgroundColor:[UIColor greenColor]];
        } else {
            TCSlider *slider = [_seqSliders objectAtIndex:i];
            [slider setBackgroundColor:[UIColor grayColor]];
        }
    }
    [UIView commitAnimations];
}
The view's delegate method that gets called when one of the view's sliders is moved:

code:
//in SEQViewController.m

- (void)ugViewDidChangeParameter:(int)parameter toValue:(id)value forUG:(int)ugIndex {    
    //for seq view, test for start change (to trigger view update)
        if (ugIndex == [[[sharedCC liveSEQs] objectAtIndex:i] startPositionUGIndex]) {
            switch (parameter) {
                case kUGConstValueParameter:
                case kUGMinValueParameter:
                {
                    [[_SEQViews objectAtIndex:i] setSeqStartPosition:[value intValue]];
                }
                    break;
                case kUGControllerAndCategoryParameter:
                {
                    if ([[value objectAtIndex:1] intValue] == kConstantCategory) {
                        int startPosition = [[[sharedCC liveUGs] objectAtIndex:ugIndex] constValue];
                        [[_SEQViews objectAtIndex:i] setSeqStartPosition:startPosition];
                    } else {
                        int startPosition = [[[sharedCC liveUGs] objectAtIndex:ugIndex] maxValue];
                        [[_SEQViews objectAtIndex:i] setSeqStartPosition:startPosition];
                    }
                }
                    break;
                default:
                    break;
            }
            //update range display
            [[_SEQViews objectAtIndex:i] updateSeqRangeDisplay];
        }
    }
}
The same delegate has this method that key-value observes a value, and calls the same updateSeqRangeDisplay method:

code:
//in SEQViewController.m

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
    if ([keyPath isEqualToString:@"currentSeqIndex"]) {
        NSNumber *newVal = [change valueForKey:NSKeyValueChangeNewKey];
        if (_currentContentTab == kSEQContentTab) {
            for (int i=0; i<[_SEQViews count]; i++) {
                SEQView *sv = [_SEQViews objectAtIndex:i];
                [sv setSeqStartPosition:[newVal intValue]];
                [sv updateSeqRangeDisplay];
            }
        }
    }
}
The KVO method will call updateSeqRangeDisplay, and it runs with the new value, but nothing in the display changes.

lord funk
Feb 16, 2004

If you want a simplified version, I swapped out the slider display function for this much simpler test:

code:
//in SEQView.m

- (void)testDisplayUpdate:(int)index {
    [testLabel setText:[NSString stringWithFormat:@"%i",index]];
    NSLog(@"testDisplayUpdate %i",index);
}
It should just change the text of a label, but it doesn't. It will print out the right value though.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Nothing obvious jumps out at me. Are you sending messages to views from the main thread?

lord funk
Feb 16, 2004

pokeyman posted:

Nothing obvious jumps out at me. Are you sending messages to views from the main thread?

Yes. Do you think the KVO is working on another thread or something?

I've been playing further, and it will will sometimes update the view when the view first loads (but only then sometimes). Or, with the slider color method, if you set the color manually it will 'fight' the KVO value and try and update both of them. But at least it's updating! If I can just figure out why.

lord funk fucked around with this message at 23:46 on Jul 16, 2011

Doc Block
Apr 15, 2003
Fun Shoe
KVO is supposed to be synchronous AFAIK, but that doesn't necessarily mean the observer gets called on the same thread.

Try performSelectorOnMainThread, so your observe method would instead do
code:
[sv performSelectorOnMainThread:@selector(setSeqStartPosition:) withObject:[newVal integer] wait:YES];
[sv performSelectorOnMainThread:@selector(updateSeqRangeDisplay) withObject:nil wait:NO];
or something.

edit: or maybe you have conflicting key-value observations

Doc Block fucked around with this message at 00:04 on Jul 17, 2011

lord funk
Feb 16, 2004

Doc Block posted:

KVO is supposed to be synchronous AFAIK, but that doesn't necessarily mean the observer gets called on the same thread.

Try performSelectorOnMainThread, so your observe method would instead do
code:
[sv performSelectorOnMainThread:@selector(setSeqStartPosition:) withObject:[newVal integer] wait:YES];
[sv performSelectorOnMainThread:@selector(updateSeqRangeDisplay) withObject:nil wait:NO];
or something.

edit: or maybe you have conflicting key-value observations

OH YES. *fist pump*

Thanks Doc, pokey.

trigger9631
Nov 18, 2004

I love my ducks.
I'm working on a research project for work about mobile apps and would like to interview some developers about marketing/promotional strategies for apps. It would be a quick interview, just five questions or so, and I could do it over phone or email.

I could even just post the questions in the thread; would people answer them if I did? I don't want to interfere with the flow of this thread and clog it up with my project.

Let me know if you're interested via a reply, a PM, or an email to jpeters@waggeneredstrom.com. Thanks for your help, appreciate it!

Full disclosure: I work for a PR agency, but I won't be soliciting our services at all. This project is strictly research-based.

OHIO
Aug 15, 2005

touchin' algebra

trigger9631 posted:

I'm working on a research project for work about mobile apps and would like to interview some developers about marketing/promotional strategies for apps. It would be a quick interview, just five questions or so, and I could do it over phone or email.

I could even just post the questions in the thread; would people answer them if I did? I don't want to interfere with the flow of this thread and clog it up with my project.

Let me know if you're interested via a reply, a PM, or an email to jpeters@waggeneredstrom.com. Thanks for your help, appreciate it!

Full disclosure: I work for a PR agency, but I won't be soliciting our services at all. This project is strictly research-based.

It's simple, just get featured by Apple.

Toady
Jan 12, 2009

lord funk posted:

The same delegate has this method that key-value observes a value, and calls the same updateSeqRangeDisplay method

By the way, you should be using the context argument and calling super if there's no match (explained here).

code:

// Simplest way to create a unique context.
static void *aUniqueKVOContext = &aUniqueKVOContext;

...

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
    if (context == aUniqueKVOContext) {
        // Your code here.
    } else
        [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}

KidDynamite
Feb 11, 2005

Are there any new books out that deal with Xcode 4? Since Lion is not compatible with Xcode 3.

Doc Block
Apr 15, 2003
Fun Shoe
The new edition of Cocoa Programming For Mac OS X is coming out in October, I think it's been updated for Xcode 4. Also Snow Leopard! ;)

Unfortunately even tech book publishers are slow and usually a version or two behind.

You can still use the information in books written for Xcode 3, the stuff specific to Xcode will just be a little different.

Doc Block fucked around with this message at 16:54 on Jul 20, 2011

lord funk
Feb 16, 2004

KidDynamite posted:

Are there any new books out that deal with Xcode 4? Since Lion is not compatible with Xcode 3.

If you use an older book, Googling things that are in the wrong place can fill in the blanks. Either way, books are no substitute for this thread. Case in point:

Toady posted:

By the way, you should be using the context argument and calling super if there's no match (explained here).

You guys are awesome.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
Where Xcode 4 changed things it tended to make them more sensible and straightforward, so don't be afraid of jumping into the fray.


quote:

You guys are awesome.

I want to second this; thanks to lumpy for helping me with my help file, and thanks to everyone else who has dispensed advice.



Also Storm Sim v3 is in review right now. :ohdear: It's like an addiction or something, waiting for approval and waiting for sales numbers.

Siguy
Sep 15, 2010

10.0 10.0 10.0 10.0 10.0
Xcode 4.1 appears to be free now. No more $5 fee for non-developers.

Edit: Though it does require Mac OS X Lion.

Adbot
ADBOT LOVES YOU

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

Siguy posted:

Xcode 4.1 appears to be free now. No more $5 fee for non-developers.

Edit: Though it does require Mac OS X Lion.


Just for those who aren't aware, this is due to how Apple does their accounting. Time spent developing a feature after the sale can't be charged as expenses to that revenue since it was already recognized but it can't go in the bucket for the next version either since you are releasing it to a bunch of versions so you end up spending money on something without being able to deduct it from your taxes.

Apple has started holding back revenue from all their products so when they do new features after the fact they can charge part of that development against the held-back revenue. That's why the original iPod update and Airport Extreme stuff cost a few bucks to enable but newer features don't... Apple holds back about $15 from iPods and iPhones and about $30 from macs, leaving that money in limbo instead of reporting it as profit so when they release the iCloud stuff for free they can deduct all the cost of developing and running iCloud from that held-back revenue, meaning they can take it off their taxes.



Speaking of... Pro Tip #5823: for all of you making money from your apps, you are probably using cash accounting so you can't use tricks like that but you can and *should* be keeping track of all your expenses so you can write off part of that income on your taxes. And since you are using your mac as a dev machine to generate revenue, a new HDD/monitor, etc all counts as a business expense. Develop iPhone apps? Your cell phone plan and phone are a business expense. A portion of your internet access is also a business expense. Setup a spare room in your house/apt as an office? Part of your house is a deductible business expense.

Keep receipts/bills and track everything. You will save a bunch of money come tax time.

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