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
lord funk
Feb 16, 2004

So in iOS 7, the system stores a screenshot for transitions. But when waking from sleep and unlocking, it sometimes flashes a different screen than the current one. Sometimes the multitasking view has a different one too. Is this just buggy system behavior, or am I responsible for letting the system know to capture a new screenshot?

Adbot
ADBOT LOVES YOU

haveblue
Aug 15, 2005



Toilet Rascal
I think that's just buggy system behavior, or it's using default.png instead of the most recent screenshot. Either way, you have no control over it.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!

Doc Block posted:

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.

I spent some extra time reading through that and I think it makes a bit more sense now. Basically receipts are from now on stored in that special file in the bundle and you can access the list of IAP receipts from it. Would have been nice if they perhaps provided a nice API on top of that, but I guess this is fertile ground for someone to make a library for it.

Doc Block
Apr 15, 2003
Fun Shoe

lord funk posted:

So in iOS 7, the system stores a screenshot for transitions. But when waking from sleep and unlocking, it sometimes flashes a different screen than the current one. Sometimes the multitasking view has a different one too. Is this just buggy system behavior, or am I responsible for letting the system know to capture a new screenshot?

Sounds like both. iOS 7 uses the UIKit persistence stuff to know when to update the screenshots IIRC, but if you're doing something unusual or a lot of custom stuff or whatever then maybe it's getting confused.

lord funk
Feb 16, 2004

Doc Block posted:

Sounds like both. iOS 7 uses the UIKit persistence stuff to know when to update the screenshots IIRC, but if you're doing something unusual or a lot of custom stuff or whatever then maybe it's getting confused.

It's a UITabBarController in a storyboard, so I'm leaning towards buggy OS at this point. I don't see why it wouldn't catch that the user switched to an entirely different fullscreen view controller.

lord funk
Feb 16, 2004

Man the CoreAudio team needs to hire some fresh engineers that don't think C-style coding is current and useful. If multipeer networking can be accomplished with a few high level methods, I should be able to advertise my audio unit without having to deal with this crap:

kAudioComponentErr_NotPermitted = -66748,

Well that's useful. I'm sorry I tried to run your sample code, I guess it's not permitted?

Edit: okay, they do actually describe what's wrong in the AudioComponent.h header where these are declared. I have to learn to look in headers more; the 'documentation' is almost always useless.

lord funk fucked around with this message at 18:07 on Sep 22, 2013

Doc Block
Apr 15, 2003
Fun Shoe
This is more of a general programming question, but it's for an iOS game being written in Objective-C so I figure it's OK to ask it here.

In a game I'm working on, the screen will have randomly placed objects of varying sizes on the screen, under the control of a physics engine. If the user taps on two objects (or more) in sequence that are colliding, the objects are removed from the game, provided that other conditions are met.

Finding out which objects are colliding is the easy part, since the physics engine reports each collision in a callback. My question is more along the lines of how best to store those collisions and search through them when the player is tapping on consecutive objects, so the game can see if they're colliding or not and build up a chain of touching objects that the player has tapped on.

I thought maybe just make a new object type (CollisionObject or whatever) that just stores a weak pointer to two colliding game objects, and in the physics engine's collision callback make a new CollisionObject and add it to a NSMutableArray (and remove it from the array if/when the physics engine reports that the objects have separated). Then, when the player taps on an object just search through the array of CollisionObjects and see if it's in there, if it's touching the last object the player tapped, etc.

But this method sounds really suboptimal since there could be a lot of creating/removing objects and resizing the collision NSMutableArray per frame, etc.

Any ideas how best to handle this? Does anything I just wrote even make sense?

Hughlander
May 11, 2005

Doc Block posted:

This is more of a general programming question, but it's for an iOS game being written in Objective-C so I figure it's OK to ask it here.

In a game I'm working on, the screen will have randomly placed objects of varying sizes on the screen, under the control of a physics engine. If the user taps on two objects (or more) in sequence that are colliding, the objects are removed from the game, provided that other conditions are met.

Finding out which objects are colliding is the easy part, since the physics engine reports each collision in a callback. My question is more along the lines of how best to store those collisions and search through them when the player is tapping on consecutive objects, so the game can see if they're colliding or not and build up a chain of touching objects that the player has tapped on.

I thought maybe just make a new object type (CollisionObject or whatever) that just stores a weak pointer to two colliding game objects, and in the physics engine's collision callback make a new CollisionObject and add it to a NSMutableArray (and remove it from the array if/when the physics engine reports that the objects have separated). Then, when the player taps on an object just search through the array of CollisionObjects and see if it's in there, if it's touching the last object the player tapped, etc.

But this method sounds really suboptimal since there could be a lot of creating/removing objects and resizing the collision NSMutableArray per frame, etc.

Any ideas how best to handle this? Does anything I just wrote even make sense?

How many objects? How long after a collision can you touch? It looks like you have a use for the same structure twice honestly:

Object A touched Object B touch will expire at time Y.
The touch could be a collision or it could be that the player touched A then B (before going on to C)

The structure I'd use though would be a C++ deque, each time there's a touch/collision push it on the back of the list. Each frame look at the front of the list and pop off any expired events. When you get the touch event, walk the touch one to look at the chain and remove the objects.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
My brain is seizing up; is there any way to build in Xcode 5 without having your app pickup the new iOS 7 look & feel? My target is set to 6.0 but on 7 it has this horrible combination of old and new styles that I'd prefer to avoid, but I want to get a bug fix out without doing a redesign just yet.

edit: Anyone know how Apple does the weather effects in the stock weather app? I wonder if that's OpenGL shaders or are they cheating with a side-scrolling image?

lord funk
Feb 16, 2004

Ender.uNF posted:

My brain is seizing up; is there any way to build in Xcode 5 without having your app pickup the new iOS 7 look & feel? My target is set to 6.0 but on 7 it has this horrible combination of old and new styles that I'd prefer to avoid, but I want to get a bug fix out without doing a redesign just yet.

edit: Anyone know how Apple does the weather effects in the stock weather app? I wonder if that's OpenGL shaders or are they cheating with a side-scrolling image?

You need to set the Base SDK to 6.0, which I think you can do by getting the old SDK out of the old Xcode's contents (Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOSx.x.sdk).

Doc Block
Apr 15, 2003
Fun Shoe

Hughlander posted:

How many objects? How long after a collision can you touch? It looks like you have a use for the same structure twice honestly:

Object A touched Object B touch will expire at time Y.
The touch could be a collision or it could be that the player touched A then B (before going on to C)

The structure I'd use though would be a C++ deque, each time there's a touch/collision push it on the back of the list. Each frame look at the front of the list and pop off any expired events. When you get the touch event, walk the touch one to look at the chain and remove the objects.

Actually, I just found out that the physics engine I'm using (Chipmunk 2D) has a method that will tell you all the objects that are touching any given object, so all I'll have to do is wait until the player taps on an object, make it the first object in the chain, when the player taps the next object see if it's touching the previous object and, if so, add it to the chain as well, and so on.

klem_johansen
Jul 11, 2002

[be my e-friend]
I've recently finished an app that uses uiwebview to embed YouTube & Vimeo trailers. The method displays the video summary page and a play button. The user clicks the play button and the video plays full screen on the phone. It works fine on every phone I've tried. Except- the new iPhone5 I'm now testing on won't play audio for some reason. The same YouTube/Vimeo links play with audio if I get to them from Safari.

I haven't seen this reported as a bug or anything, so I can't be sure what's going on.

code:
-(void)embedYouTube{
    CGRect frame = CGRectMake(0,0, self.view.frame.size.width,self.view.frame.size.height);
    UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
    videoView.backgroundColor = [UIColor clearColor];
    [self.view addSubview:videoView];
    [videoView setDelegate:self];
    
    NSURL *websiteUrl = [NSURL URLWithString:sharedSingleton.hff_trailer_url];
    NSURLRequest *urlRequest = [NSURLRequest requestWithURL:websiteUrl];
    [videoView loadRequest:urlRequest];
}

I had been doing the iFrame approach but it worked fine to just embed the primary youtube & vimeo links. For example: https://vimeo.com/72671611

Edit: If I can't solve it I can probably add something that checks if the device is an iPhone5 then open the YouTube/Vimeo link outside the app. That isn't what the client wants, but if it's a bug or something I have to work around, that may be the way I have to do it.

klem_johansen fucked around with this message at 16:23 on Sep 23, 2013

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

klem_johansen posted:

I've recently finished an app that uses uiwebview to embed YouTube & Vimeo trailers. The method displays the video summary page and a play button. The user clicks the play button and the video plays full screen on the phone. It works fine on every phone I've tried. Except- the new iPhone5 I'm now testing on won't play audio for some reason. The same YouTube/Vimeo links play with audio if I get to them from Safari.

I haven't seen this reported as a bug or anything, so I can't be sure what's going on.

Is the silent switch turned on? Just a sanity check, because post-iOS6 the silent switch will silence videos in your app by default and it's not the most obvious thing. You have to do a little work around to make it work like you might expect.

Hanpan
Dec 5, 2004

I need to skeleton / prototype a simple app that pulls contacts from AddressBook and stores little bit of data locally. Can anyone recommend places where I can source some reliable iOS developers as Freelance and Elance are apparently scam central.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
Did we have a thread somewhere for developers looking for contract work?

Hanpan
Dec 5, 2004

Ender.uNF posted:

Did we have a thread somewhere for developers looking for contract work?

I had a quick look. Was nervous of asking directly incase it was against forum rules or whatever. If anyone is looking for a quick win super easy job ping me a PM. All sorted now. Thanks!

Hanpan fucked around with this message at 21:05 on Sep 26, 2013

fankey
Aug 31, 2001

I have a UIPopoverController whose content is set to a UITableViewController. Pre iOS 7 I was able to use the following code in my class derived from UITableViewController so the Popover was automatically sized based on my content
Objective-C code:
-(CGSize) contentSizeForViewInPopover
{
  double w = 100;
  for( int ix = 0; ix < [self.tableView numberOfRowsInSection:0]; ix++ )
  {
    UITableViewCell* cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:ix inSection:0]];
    UIFont* font = cell.textLabel.font;
    // yes, the +20 was a fudge factor...
    w = fmax(w, [cell.textLabel.text sizeWithFont:font].width + 20 );
  }
  return CGSizeMake(w, self.tableView.rowHeight*[self.tableView numberOfRowsInSection:0] );
}
This doesn't work anymore in iOS 7. Since contentSizeForViewInPopover is deprecated I switched to overriding preferredContentSize but that didn't fix the issue. I was able to make the content so it was visible by using
Objective-C code:
-(CGSize) preferredContentSize
{
  // self.choices is a list of strings to display
  double w = 100;
  double h = 0;
  for( NSString* choice in self.choices )
  {
    UITableViewCell* cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
    cell.textLabel.text = choice;
    w = fmax( w, cell.frame.size.width);
    h += cell.frame.size.height;
  }
  return CGSizeMake(w, h);
}
but that seems a little ugly since it's creating a bunch of UITableViewCells and throwing them away. Is there a better way to determine the default size of a UITableViewCell?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

fankey posted:

Is there a better way to determine the default size of a UITableViewCell?

Might be getting this wrong but isn't your actual goal to make the popover the size of the table view? If so, can you lay out the table view then return its size?

NoDamage
Dec 2, 2000

fankey posted:

but that seems a little ugly since it's creating a bunch of UITableViewCells and throwing them away. Is there a better way to determine the default size of a UITableViewCell?
Based on your old code it looks like you want fixed height cells but a variable width table view/popover... In that case, why not use sizeWithFont: like before to determine the max width, and then get the total height using self.choices.count * self.tableView.rowHeight? You don't really need the cell since you already have the string that goes into the cell.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Can anybody confirm that Apple allows regular people to ship apps that include no way for someone to sign-up for an account within the app itself? I'm thinking Netflix/Hulu which afaik you can only sign-up for from their respective websites. I'm wondering if a normal person could get away with not having a signup process or if that's for massive companies only?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

DreadCthulhu posted:

Can anybody confirm that Apple allows regular people to ship apps that include no way for someone to sign-up for an account within the app itself? I'm thinking Netflix/Hulu which afaik you can only sign-up for from their respective websites. I'm wondering if a normal person could get away with not having a signup process or if that's for massive companies only?

Awful is such an app and has had no issues getting through review. Make sure to supply the reviewer with a test account.

Doctor w-rw-rw-
Jun 24, 2008

DreadCthulhu posted:

Can anybody confirm that Apple allows regular people to ship apps that include no way for someone to sign-up for an account within the app itself? I'm thinking Netflix/Hulu which afaik you can only sign-up for from their respective websites. I'm wondering if a normal person could get away with not having a signup process or if that's for massive companies only?

Huh? Netflix/Hulu ship because Apple explicitly does not allow them to sign up from the app.

The reason they do this is because their payment methods do not involve in-app purchases, so the subscription has to be entirely out-of-band.

No matter if there is no signup. Just submit with credentials for a test account.

Zhentar
Sep 28, 2003

Brilliant Master Genius
We ship an app has no public sign up at all (paid or otherwise), without any problems.

fankey
Aug 31, 2001

pokeyman posted:

Might be getting this wrong but isn't your actual goal to make the popover the size of the table view? If so, can you lay out the table view then return its size?
I'm not sure how would I lay out the table view. I first get the preferredContentSize callback and then get numberOfSectionsInTableView/numberOfRowsInSection/cellForRowAtIndexPath so at the point where the Popover is asking for the size I haven't gotten any callbacks to let the TableView know its content.

fankey
Aug 31, 2001

NoDamage posted:

Based on your old code it looks like you want fixed height cells but a variable width table view/popover... In that case, why not use sizeWithFont: like before to determine the max width, and then get the total height using self.choices.count * self.tableView.rowHeight? You don't really need the cell since you already have the string that goes into the cell.
My old code, while it worked, was a pretty crude hack - hence the random +20 added to each width. Since Apple might change the margins on the default TableViewCellStyle in iOS 13 I'd like to actually figure out the real size of each cell.

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.
Is there an easy way to compile in x86_64 for use in the iOS Simulator "iPhone Retina (4-inch 64-bit)" so that I could see how my code works on a 64-bit processor? I understand it's not guaranteed to be the same as having an actual iPhone 5S, but I was curious. If I select that 64-bit simulator and compile, it still goes to i386.

Also, I have VFP and NEON assembly for doing matrix operations, should I expect that it won't work as is with 64-bit processors?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

fankey posted:

I'm not sure how would I lay out the table view. I first get the preferredContentSize callback and then get numberOfSectionsInTableView/numberOfRowsInSection/cellForRowAtIndexPath so at the point where the Popover is asking for the size I haven't gotten any callbacks to let the TableView know its content.

Try calling -layoutIfNeeded on the table view. And make sure it's the right width first.

fankey
Aug 31, 2001

pokeyman posted:

Try calling -layoutIfNeeded on the table view. And make sure it's the right width first.

The content loaded into the TableView is dynamic ( read from a remote server ). How would I go about making sure the table is the right width?

Doc Block
Apr 15, 2003
Fun Shoe

HiriseSoftware posted:

Also, I have VFP and NEON assembly for doing matrix operations, should I expect that it won't work as is with 64-bit processors?

Correct. ARM64 uses a completely new instruction set (ARMv8) that isn't backwards compatible at all, so any existing assembly will have to be rewritten.

NoDamage
Dec 2, 2000

fankey posted:

My old code, while it worked, was a pretty crude hack - hence the random +20 added to each width. Since Apple might change the margins on the default TableViewCellStyle in iOS 13 I'd like to actually figure out the real size of each cell.
Well you've got a bit of a chicken-and-egg scenario. The cell width is determined by the table width. The table width is determined by the popover size. If you want the popover width to be determined based on the width of your longest string, you're going to have to calculate that ahead of time. Otherwise, if you're okay using the default width (320) on your popover, then you can force the table view to layout in order to calculate the height like pokeyman mentioned.

fankey
Aug 31, 2001

NoDamage posted:

Well you've got a bit of a chicken-and-egg scenario. The cell width is determined by the table width. The table width is determined by the popover size. If you want the popover width to be determined based on the width of your longest string, you're going to have to calculate that ahead of time. Otherwise, if you're okay using the default width (320) on your popover, then you can force the table view to layout in order to calculate the height like pokeyman mentioned.
My fixed code that I posted does work - if I create a UITableViewCell which isn't associated with a UITableView, it's frame appears to be correct based on the string I set. In that case the cell width is determined by the text and not the table width - it has no assocication to any table. It just seem inefficient and I was curious if there was a better way.

Doh004
Apr 22, 2007

Mmmmm Donuts...
Anyone know why I can't change my UISearchBar's textColor in iOS7?

code:
[self.SearchBar setBarStyle:UIBarStyleBlack];
[self.SearchBar setTranslucent:NO];
[self.SearchBar setTintColor:[UIColor blackColor]];
[self.SearchBar setBarTintColor:[UIColor whiteColor]];
[self.SearchBar setBackgroundColor:[UIColor clearColor]];
Produces this:

NoDamage
Dec 2, 2000

fankey posted:

My fixed code that I posted does work - if I create a UITableViewCell which isn't associated with a UITableView, it's frame appears to be correct based on the string I set. In that case the cell width is determined by the text and not the table width - it has no assocication to any table. It just seem inefficient and I was curious if there was a better way.
Doesn't that just give you 320x44 for every cell though?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

fankey posted:

The content loaded into the TableView is dynamic ( read from a remote server ). How would I go about making sure the table is the right width?

I guess I'm not sure what you're trying to accomplish. My suggestion was to fill out your table view (remote data, local data, whatever, just -reloadData once you're ready), then lay it out at various widths until you find a bounds that suits you. If it's already visible though that's gonna look pretty stupid, so maybe you measure it using cells or asking UIKit to lay out your strings.

Also you can change the popover's content size on the fly, and animate the changes too, if that's useful.

fankey
Aug 31, 2001

NoDamage posted:

Doesn't that just give you 320x44 for every cell though?

Oops, you're correct. It just happened that my test data fit pretty much perfectly in 320...

fankey
Aug 31, 2001

pokeyman posted:

I guess I'm not sure what you're trying to accomplish. My suggestion was to fill out your table view (remote data, local data, whatever, just -reloadData once you're ready), then lay it out at various widths until you find a bounds that suits you. If it's already visible though that's gonna look pretty stupid, so maybe you measure it using cells or asking UIKit to lay out your strings.

Also you can change the popover's content size on the fly, and animate the changes too, if that's useful.
You're confused because I'm not explaining things well enough and probably because I'm not experienced enough in iOS stuff to follow your suggestions.

Previously I was just measuring the strings to determine the width. I just didn't feel that comfortable with that approach since I had to hardcode a margin so it looked ok and at some point Apple might change the margins used by the cell. I guess one solution would be to provide my own cell style but I was hoping to get by using the default since it will better match iOSs look and feel.

NoDamage
Dec 2, 2000

fankey posted:

Oops, you're correct. It just happened that my test data fit pretty much perfectly in 320...
Well if you're okay with that kind of sizing the easiest thing to do is probably KVO the tableView's contentSize:

code:
- (void)viewDidLoad {
    [super viewDidLoad];
    ...
    [self.tableView addObserver:self forKeyPath:@"contentSize" options:NSKeyValueObservingOptionNew context:NULL];
}

- (void)dealloc {
    [self.tableView removeObserver:self forKeyPath:@"contentSize"];
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
    if ([keyPath isEqualToString:@"contentSize"]) {
        self.preferredContentSize = self.tableView.contentSize;
    }
}
This also works really well if you happen to have variable height cells (although you don't in this example).

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

NoDamage posted:

KVO the tableView's contentSize

Fun fact: this (and KVOing UIKit objects in general) is unsupported!

It seems pretty widespread though, at least for UIScrollView's contentOffset and contentSize properties, so I imagine some effort is spent to keep it working.

Doctor w-rw-rw-
Jun 24, 2008

pokeyman posted:

Fun fact: this (and KVOing UIKit objects in general) is unsupported!

Is this true or is this alluding to the actual problem which is that UIViews aren't key-value compliant (unlike CALayers, which are)?

As a ginormous hack, I've used CALayers to store data, when I had no other (politically viable*) option.

* hated that job

Fun fact! Calling [[[UIDevice] currentDevice] userInterfaceIdiom] from +initialize in a non-universal app running on an iPad device will return the wrong idiom. The solution is to read the value from the info dictionary (info.plist), for which the documented format of UIDeviceFamily is also slightly wrong.

Adbot
ADBOT LOVES YOU

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Are there any libraries/services out there I can integrate in my app to add video-conferencing, screen-sharing and voice-communication? I think Twilio takes care of the voice part of it, but I haven't heard of solutions for the other ones. Any advice?

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