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
PT6A
Jan 5, 2006

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

Monkeyseesaw posted:

I've just started getting into iOS development over the last couple months and Autolayout is by far the biggest wtf I've come across. I *still* don't understand it and trying to get a view to scale how I want comes down to deleting random constraints until both IB is happy and I get the behavior I want.

More often than not these are two conflicting requirements.

Honestly, it's getting to the point where (assuming your view isn't very complex) it's probably better just to do it in code. I wrote 5 lines of code to replace what I'd been trying unsuccessfully to do in IB with AutoLayout for a loving hour. Not to mention the fact that it'll put constraints in automatically, so occasionally your views will hop around if you need to do something unthinkably rare like, oh, hide a view at runtime or something.

I remember getting pissed off at Android's layout tools, but they are a loving dream compared to what Apple's done.

To be fair, dealing with iOS 7 and IB is less of a complete pain in the rear end if you're working with storyboards, but there's now so many important things in the controller itself that working with XIBs is drat near impossible.

PT6A fucked around with this message at 01:02 on Sep 18, 2013

Adbot
ADBOT LOVES YOU

dizzywhip
Dec 23, 2005

Does anyone have any experience with iCloud? I'm trying to handle losing/gaining connection to iCloud in my app, which, according to the documentation, should be able to be done by registering for NSUbiquityIdentityDidChangeNotification and checking the ubiquityIdentityToken. But whenever I turn on/off Documents and Data storage for my app in the system preferences, the notification never fires, and the values of ubiquityIdentityToken and the ubiquity container URL never change. So basically I have no way of testing changes in iCloud connectivity.

Any thoughts? This is on OS X, by the way.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
Try disconnecting your network connection or using an app like Little Snitch.

dizzywhip
Dec 23, 2005

Turning off wifi weirdly seems to have no effect aside from the fact that changes to iCloud documents won't be synced until it gets turned back on. I can still get an identity token, and I still have access to the ubiquity container.

It would be nice if there was a "toggle iCloud connection" option in the debug menu of Xcode.

Doctor w-rw-rw-
Jun 24, 2008

Monkeyseesaw posted:

I've just started getting into iOS development over the last couple months and Autolayout is by far the biggest wtf I've come across. I *still* don't understand it and trying to get a view to scale how I want comes down to deleting random constraints until both IB is happy and I get the behavior I want.

More often than not these are two conflicting requirements.

PT6A posted:

Honestly, it's getting to the point where (assuming your view isn't very complex) it's probably better just to do it in code. I wrote 5 lines of code to replace what I'd been trying unsuccessfully to do in IB with AutoLayout for a loving hour. Not to mention the fact that it'll put constraints in automatically, so occasionally your views will hop around if you need to do something unthinkably rare like, oh, hide a view at runtime or something.

I remember getting pissed off at Android's layout tools, but they are a loving dream compared to what Apple's done.

To be fair, dealing with iOS 7 and IB is less of a complete pain in the rear end if you're working with storyboards, but there's now so many important things in the controller itself that working with XIBs is drat near impossible.
This seems to be a common thing where people start to realize that at some point, using IB imposes its own kind of complexity, and the value of using it...changes. I like complexity I can search and refactor. :smugdog:

Also note that storyboards impose a time-to-interaction tax on app startup (that is, they delay startup, slightly) . Loading a nib is fine, but loading tons of them will have a noticeable impact on startup times.

Gordon Cole posted:

Does anyone have any experience with iCloud? I'm trying to handle losing/gaining connection to iCloud in my app, which, according to the documentation, should be able to be done by registering for NSUbiquityIdentityDidChangeNotification and checking the ubiquityIdentityToken. But whenever I turn on/off Documents and Data storage for my app in the system preferences, the notification never fires, and the values of ubiquityIdentityToken and the ubiquity container URL never change. So basically I have no way of testing changes in iCloud connectivity.

Any thoughts? This is on OS X, by the way.

An alternative to turning your network off is using Network Link Conditioner at a very high (or 100%) packet loss. But then that also means you don't have a useful test for connectivity, either.

Doctor w-rw-rw- fucked around with this message at 18:03 on Sep 18, 2013

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

PT6A posted:

Honestly, it's getting to the point where (assuming your view isn't very complex) it's probably better just to do it in code. I wrote 5 lines of code to replace what I'd been trying unsuccessfully to do in IB with AutoLayout for a loving hour.

I only started with Auto Layout a couple weeks ago and have used it only from code, and it's been a good experience. Between the visual format language and a couple handy snippets, it's pretty easy.

That said, Auto Layout is entirely opt-in. If it doesn't get the job done for you, or if you already have a working solution, go back to springs and struts or -layoutSubviews. There's no shame in it.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
When I'm using UIKit's state preservation and restoration, how do I deal with my view controllers' delegates?

For example, given
Objective-C code:
@protocol ComposeDelegate;

@interface ComposeViewController : UIViewController

@property (weak, nonatomic) id <ComposeDelegate> delegate;
@property (readonly, copy, nonatomic) NSString *message;

@end

@protocol ComposeDelegate <NSObject>

- (void)composeViewControllerDidFinish:(ComposeViewController *)cvc;

@end
and typical setup is
Objective-C code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    ComposeViewController *cvc = [ComposeViewController new];
    cvc.delegate = self;
    cvc.restorationIdentifier = @"Do it";
    [self presentViewController:cvc animated:YES completion:nil];
}

- (void)composeViewControllerDidFinish:(ComposeViewController *)cvc
{
    [self sendComposition:cvc.message];
    [self dismissViewControllerAnimated:YES completion:nil];
}
When my app's state is restored, the compose view controller is re-presented all fine and dandy. But its delegate is no longer connected, so my cancel button is broken. What should I do?

Should I be storing the delegate in -[ComposeViewController encodeRestorableStateWithCoder:]? It feels wrong to store the value of a weak property. Plus there's no guarantee it's state preservable/restorable anyway.

Should I store the presented view controller as part of my table view's state preservation? Then I need to do that everywhere I present the view controller. And I'm working around UIKit's built-in preservation of presented view controllers.

Or is this a stupid use of a delegate and I'm just doing it wrong?

What have others done to solve this? I'm leaning towards storing the presented view controller and re-presenting it on state restore. But then why does UIKit bother preserving presented view controllers automatically?

edit: change example to something less trivial than simple dismissal.

pokeyman fucked around with this message at 18:50 on Sep 18, 2013

Doctor w-rw-rw-
Jun 24, 2008
Fun fact time!

nil not the same thing as '((void *)0)' in C++11, where it is defined instead as nullptr. Where does this matter? Returning nil from Objective-C blocks with implicit return types returns 'void *', not 'id'.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Doctor w-rw-rw- posted:

Fun fact time!

nil not the same thing as '((void *)0)' in C++11, where it is defined instead as nullptr. Where does this matter? Returning nil from Objective-C blocks with implicit return types returns 'void *', not 'id'.

I don't C++ enough to understand why that does matter, can you explain?

Doctor w-rw-rw-
Jun 24, 2008

pokeyman posted:

I don't C++ enough to understand why that does matter, can you explain?
C's casting is notably weaker than C++'s, which puts more effort into type safety. nullptr is a keyword rather than a value of 0 or a defined constant such as NULL, so a block in C++ code would more correctly return 'nullptr' when the value being represented is null, as opposed to 0 or whatever the NULL macro resolves to (obviously, usually 0).

So because returning nil in C++ is defined differently, the signature of the block can be different as a result of an implicit return type when using Objective-C++.

Melinoe
Jul 27, 2012

Why isn't it Froderick?
This is kind of a long shot, but do any of you guys have any experience with AVVideoCompositionCoreAnimationTool? I'm using in my app and it was working great in iOS 6, but as soon as I updated to 7 it just stopped working for no apparent reason. I still get an output video just like I did before but it's missing all of the animations that are supposed to be on top of it. From what I can tell it isn't used much so there isn't a ton of information about it, but I thought maybe someone here would know something.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Doctor w-rw-rw- posted:

C's casting is notably weaker than C++'s, which puts more effort into type safety. nullptr is a keyword rather than a value of 0 or a defined constant such as NULL, so a block in C++ code would more correctly return 'nullptr' when the value being represented is null, as opposed to 0 or whatever the NULL macro resolves to (obviously, usually 0).

So because returning nil in C++ is defined differently, the signature of the block can be different as a result of an implicit return type when using Objective-C++.

So the block gets the signature
Objective-C code:
nullptr(^)(void)
?

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

quote:

Previous versions of your apps are now available for re‑download by users who have already purchased them, allowing customers to use your apps with older devices which may no longer be supported by the current version of your app. If you do not wish to make these versions available, you can manage the availability of your apps' previous versions in the Rights and Pricing section of the Manage Your Apps module in iTunes Connect.

Thank you Jesus.

This whole legacy apps thing was kinda terrifying if there's a server involved.

Hughlander
May 11, 2005

ultramiraculous posted:

Thank you Jesus.

This whole legacy apps thing was kinda terrifying if there's a server involved.

Not really, you should always have had versioning info and drop connection on anything too old since you never know when someone may restore form a backup from the first day your app was out.

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

Hughlander posted:

Not really, you should always have had versioning info and drop connection on anything too old since you never know when someone may restore form a backup from the first day your app was out.

Yeah, unless you use anything third party. Since Urban Airship dropped their IAP platform, the old versions of Storm Sim can't restore or make new purchases. I may end up just leaving it out there and dealing with the inevitable support requests.

Of course it's a valuable lesson and even if I wanted to use Urban Airship's push platform there is no way I'd rely on a third party again.

haveblue
Aug 15, 2005



Toilet Rascal

Hughlander posted:

Not really, you should always have had versioning info and drop connection on anything too old since you never know when someone may restore form a backup from the first day your app was out.

Yeah, it's never been possible to atomically throw a switch somewhere and guarantee that all client connections after that point are from the new version. But it was easier to have a flat "this is unsupported and you need to update" policy if Apple doesn't offer to help people get into that state. There are already vocal users who refuse to install system updates because e.g. it will undo their jailbreak.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Hughlander posted:

Not really, you should always have had versioning info and drop connection on anything too old since you never know when someone may restore form a backup from the first day your app was out.


Yeah, definitely. I mean I'm not expecting the server to blow up, but the app being non-functional is not great from a customer service perspective. I'd just much rather that some guy who brought his 4.3 iPad 1 to the meeting not be able to download anything, than let him get an Apple-vetted-ish download of a two year old version of the app. Neither case is good, but the second option feels way worse, potentially because the version delivered is/was completely out of our control.

lord funk
Feb 16, 2004

ultramiraculous posted:

Yeah, definitely. I mean I'm not expecting the server to blow up, but the app being non-functional is not great from a customer service perspective. I'd just much rather that some guy who brought his 4.3 iPad 1 to the meeting not be able to download anything, than let him get an Apple-vetted-ish download of a two year old version of the app. Neither case is good, but the second option feels way worse, potentially because the version delivered is/was completely out of our control.

I feel the opposite. I'm excited that those millions of iPad 2 models that people pick up second hand will be able to see the old version of my apps. And I will have no shame if they complain about a bug or misaligned feature: it's available as-is.

haveblue
Aug 15, 2005



Toilet Rascal

lord funk posted:

I feel the opposite. I'm excited that those millions of iPad 2 models that people pick up second hand will be able to see the old version of my apps. And I will have no shame if they complain about a bug or misaligned feature: it's available as-is.

Does your app talk to a server?

lord funk
Feb 16, 2004

haveblue posted:

Does your app talk to a server?

No, and I totally get why this would piss developers off. I'm lucky in that my app is standalone.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

lord funk posted:

No, and I totally get why this would piss developers off. I'm lucky in that my app is standalone.

Ok, yeah. That's totally different. Old versions of standalone apps are still as functional as they ever were, and that's why I agree with Apple's decision in general. My big issue with the change was the original lack of an opt-out in cases where server communication issues would break/severely impact the usability of the app.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

ultramiraculous posted:

Ok, yeah. That's totally different. Old versions of standalone apps are still as functional as they ever were, and that's why I agree with Apple's decision in general. My big issue with the change was the original lack of an opt-out in cases where server communication issues would break/severely impact the usability of the app.

Unless the old version's server communication issues actively cause damage, what's the harm? I'd rather have a broken app on my iPad 1 than nothing at all.

kitten smoothie
Dec 29, 2001

I'm sure there are lots of people with ancient .ipas in iTunes on their computers and they could sync those apps back to their iPhone 3G at any time. They'd get overwritten if the user took advantage of the update functionality in iTunes, but who uses that? I don't even do that, I apparently have 137 updates pending in iTunes.

So it's not like this is a totally new problem, where someone has an old version that wants to talk to an API you're not supporting anymore. At least now you can make the call yourself as to whether to offer someone the opportunity to download the old one, if you think it will still work.

It would be nice though if you could submit an update targeted at that old release. Maybe to fix a minor bug or just add a "hey, here's whats broken on this old version" message.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Does anybody know if Apple allows apps to "expire" their content? For example, say you download an app and have to sign up for a trial account in order to use it, and that trial expires in 30 days after which the app is completely useless unless you pay up. Is that not allowed or do people do this?

DreadCthulhu fucked around with this message at 23:23 on Sep 19, 2013

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
You can disable a portion of the functionality, but the app cannot become entirely useless.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Plorkyeran posted:

You can disable a portion of the functionality, but the app cannot become entirely useless.

That doesn't sound quite right. There are plenty of apps that are useless without an account at some third party service (Facebook, Twitter).

You may have to be careful with wording (unless you offer an account purchase through in-app purchase) but I can't imagine a problem with the app kicking you out to a login screen at the end of the trial. Same as if the account was deleted.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Facebook/twitter/etc. are quite different since they don't start out functional without an account only to force you to register a month later, and the accounts are free. Requiring registration is fine; offering an iAP-based subscription with a free trial for additional functionality is fine; requiring iAPs to do anything at all is not. 11.9 is the overly-vague rule relevant here ("Apps containing "rental" content or services that expire after a limited time will be rejected").

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
transactionReceipt got deprecated in StoreKit, totally not obvious what to do now. This for reference

DreadCthulhu fucked around with this message at 01:46 on Sep 20, 2013

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Plorkyeran posted:

Facebook/twitter/etc. are quite different since they don't start out functional without an account only to force you to register a month later, and the accounts are free. Requiring registration is fine; offering an iAP-based subscription with a free trial for additional functionality is fine; requiring iAPs to do anything at all is not. 11.9 is the overly-vague rule relevant here ("Apps containing "rental" content or services that expire after a limited time will be rejected").

Unless I'm missing something, or you know something I don't, DreadCthulhu's app is entirely doable following those criteria.

Doc Block
Apr 15, 2003
Fun Shoe

DreadCthulhu posted:

transactionReceipt got deprecated in StoreKit, totally not obvious what to do now. This for reference

For iOS 7, they want you to use their new app receipt system for verifying transactions. See Receipt Validation Programming Guide. transactionReceipt is left in for backward compatibility.

A Bloody Crowbar
May 9, 2009

Has something with sprite scaling changed in SpriteKit as of DP5? I've been waiting since then for the official release to restart work on a project of mine since my developer account was terminated a while ago. I had perfectly working code uploaded as of DP5 but now anywhere I'm stretching a sprite with a modified centerRect it's completely broken and stretches the full image rect as if its unmodified... Very frustrating since everything in the docs seems exactly the same.

Doc Block
Apr 15, 2003
Fun Shoe
SpriteKit has been really buggy in my experience. I'll probably scrap my little SpriteKit game and do it in Cocos2D instead.

Doc Block fucked around with this message at 05:36 on Sep 21, 2013

A Bloody Crowbar
May 9, 2009

That is disappointing to say the least. I've been looking forward to SpriteKit, sad to see it's acting up now of all times.

Doc Block
Apr 15, 2003
Fun Shoe
SpriteKit is too feature incomplete and too buggy to be the easy alternative to Cocos2D that Apple is marketing it as. It's pretty obvious that they created it to counter Zynga making Cocos2D more cross-platform friendly.

The main reasons I was even interested in SpriteKit in the first place was being able to use CGPaths for sprites (with hardware-accelerated drawing of the path) and because of the automatic sprite batching.

But SpriteKit's CGPath drawing sucks (hope you wanted them all drawn with a thick, black stroke), and the automatic sprite batching hasn't worked well for me (still have to load the texture atlas manually, pick the textures out manually, and assign them to sprites manually to get "automatic" sprite batching to work).

And don't get me started on the physics engine...

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
If I only have non-renewing subscriptions in my app, do I need to provide the user with a Restore transactions button/flow? It sounds like that would make no sense, since your purchases are tied to your login account in the non-renewing case, but I'm wondering if there's anything in the rules that states that.

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
Is there a way to get xcode to display current objects in scope when it throws an exception like visual studio does?

i make lots of dumb stupid errors and it usually helps me find them


e: i should clarify it sorta does show stuff in scope except for an exception it's just "argv" and throws from main as opposed to a breakpoint that u insert which works just fine

Mr SuperAwesome fucked around with this message at 14:28 on Sep 21, 2013

Froist
Jun 6, 2004

Mr SuperAwesome posted:

Is there a way to get xcode to display current objects in scope when it throws an exception like visual studio does?

i make lots of dumb stupid errors and it usually helps me find them


e: i should clarify it sorta does show stuff in scope except for an exception it's just "argv" and throws from main as opposed to a breakpoint that u insert which works just fine

I've never understood why this isn't on as default, but you have to add an exception breakpoint. Go to the breakpoints tab in the left hand view, click the plus at the bottom, add exception breakpoint, "break: on throw" (default).

You have to do this for every project, it's not a global setting.

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
lmao that's terrible default behaviour.

Thank you!

lord funk
Feb 16, 2004

Doc Block posted:

The main reasons I was even interested in SpriteKit in the first place was being able to use CGPaths for sprites (with hardware-accelerated drawing of the path) and because of the automatic sprite batching.

But SpriteKit's CGPath drawing sucks

Ditto! I couldn't believe how bad the drawing was. Actually I've never understood why drawing a few simple CGPaths causes the frame rate to plummet, but I was hoping SpriteKit would be the answer.

Also, no transparent SpriteKit views meant dropping if from my current app. :(

Adbot
ADBOT LOVES YOU

Doctor w-rw-rw-
Jun 24, 2008

Froist posted:

I've never understood why this isn't on as default, but you have to add an exception breakpoint.
Because audio on iOS uses exceptions for flow control.

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