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

I think I may have found a bug in Mail on iOS 6. My app supports two UTI extensions, .tcp and .tcpg. When Mail has an attachment with .tcpg, and you try and forward / open it, it truncates it to .tcp. Gmail in Safari doesn't do this, and it isn't my app. The actual file copied into handleURL has a changed extension.

Bug report submitted.

lord funk fucked around with this message at 00:52 on Sep 28, 2012

Adbot
ADBOT LOVES YOU

tarepanda
Mar 26, 2011

Living the Dream

Doh004 posted:

Been doing iOS work for the past 2 weeks so I'm still new and I've hit a roadblock:

I have a UILabel with a set width and height (let's say 50x50). I want said label to have only 2 lines of text. I do not want any word wrapping. I want this text to scale so that the text will fit within the UILabel's dimensions with two lines.

I've set numberOfLines, minimumFontSize, adjustsFontSizeToFitWidth as well as

code:
CGSize myNewSize = [myText sizeWithFont:self.myLabel.font constrainedToSize:CGSizeMake(50, 50)];

// Set the frame on the label to this new size height
Yet it's still truncating the text with ... . Can I disable line break some how? Or, am I doing something stupidly wrong? Thanks.

What is it supposed to be doing? You don't want it to wrap but you want it on two lines -- how is it ever going to put text on the second line?

Doh004
Apr 22, 2007

Mmmmm Donuts...

tarepanda posted:

What is it supposed to be doing? You don't want it to wrap but you want it on two lines -- how is it ever going to put text on the second line?

Hmm yeah, I didn't phrase that correctly.

I was a maximum of two lines to show up. Any more than two lines and the text gets scaled down to fit into the space.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Set the label's lineBreakMode to e.g. UILineBreakModeCharacterWrap.

tarepanda
Mar 26, 2011

Living the Dream
I'm using AVCaptureSessions in multiple views -- I make sure to stopSession before I change the view. Is there anything else I need to do?

My problem is that when I check my app in the profiler using the allocations instrument, my memory usage goes up every single time I change a view. I can't figure out what's going on and the AVCaptureSession is my best guess. Is there a way of narrowing this down? :x

ALSO, is there a way to revert back to iOS 5 for testing (my app can't use the emulator) or should I just keep one of each device on iOS 5 and upgrade others to 6?

Edit: I just realized what else it could be and what it probably is.

In prepareForSegue:sender: I'm creating a pointer to segue.destinationViewController and passing some data on -- is it possible that it's actually creating a SECOND view controller automatically in addition to the one I'm using?

Edit 2: It doesn't seem like it's that -- I commented all of that out and I'm still getting big jumps in transitions between views... so I'm back to AVCaptureSession being my best guess.

tarepanda fucked around with this message at 02:22 on Sep 28, 2012

Carthag Tuek
Oct 15, 2005

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



I have an object hierarchy with numerous nested properties and I want to have a "backwards trail" on them so I can go from some deeply nested property back up to the root object (like Core Data's inverse relationships); call it a "describedObject" property . The way I see it I can do it a couple of ways:

  • Make the properties externally immutable and only handle insertion/removal with designated methods.

  • Override mutableArrayValueForKey: and wrap super's return value in my own proxy that'll take care of keeping the describedObject in sync.

  • Have my object observe the relevant keys on itself and update the trail accordingly when something changes.

  • Or override its will/didChange method and do as above.

None of them really seem ideal, though the last one would be the least intrusive. Anyone here done something similar or have ideas?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

tarepanda posted:

ALSO, is there a way to revert back to iOS 5 for testing (my app can't use the emulator) or should I just keep one of each device on iOS 5 and upgrade others to 6?
Only if you backed up the SHSH blob for the device before iOS 6 came out. If not, it's no longer possible to install 5 on a device capable of running 6.

tarepanda
Mar 26, 2011

Living the Dream
Are there numbers out there for how many people update?

i.e., is it really that important to support iOS 4 or 5 now that 6 is out?

Edit: Agggh, these custom segues work fine in iOS 6 but crash in iOS 5.

code:
-(void)perform {
    UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
    UIViewController *destinationController = (UIViewController*)[self destinationViewController];
    
    CATransition* transition = [CATransition animation];
    transition.duration = .25;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionPush; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
    transition.subtype = kCATransitionFromBottom; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
    
    [sourceViewController.navigationController.view.layer addAnimation:transition
                                                                forKey:kCATransition];
    
    [sourceViewController.navigationController pushViewController:destinationController animated:NO];
}

tarepanda fucked around with this message at 03:35 on Sep 28, 2012

Doh004
Apr 22, 2007

Mmmmm Donuts...

pokeyman posted:

Set the label's lineBreakMode to e.g. UILineBreakModeCharacterWrap.

That did something!

Now the word "moves to the left" and gets cut off. So "Capitalization" turns into "italization". Any idea?

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
I'm trying to set up a console-like text output that's simply a Label Inside of a Scroll View. What I need it to do is as I'm writing text to the screen dynamically change both the total height of the label to accomodate all of the text and vertically align it and also change the content area of the scrollview itself so nothing gets cut off as the label grows.

The code I'm using to accomplish this is as follows:

code:
- (void) writeToScreen:(NSString *)toWrite
{
    outputLabel.text = [outputLabel.text stringByAppendingString:toWrite];
    
    //Calculate the expected size based on the font and linebreak mode of your label
    CGSize maximumLabelSize = CGSizeMake(1024,50000);
    
    CGSize expectedLabelSize = [[outputLabel text] sizeWithFont:outputLabel.font constrainedToSize:maximumLabelSize lineBreakMode:outputLabel.lineBreakMode];
    
    //adjust the label the the new height.
    CGRect newFrame = outputLabel.frame;
    newFrame.size.height = expectedLabelSize.height;
    outputLabel.frame = newFrame;
    
    [scrollView setContentSize:CGSizeMake(newFrame.size.width, newFrame.size.height)];
    
    //[scrollView scrollRectToVisible:CGRectMake(newFrame.size.width, newFrame.size.height, scrollView.frame.size.width, scrollView.frame.size.height) animated:NO];
}
The 50000 is an arbitrary maximum height of the text label that it should never get to. Since there's no vertical align in a text label what I have to do is every time I add content I have to shrink itself to fit what content it does contain and make sure that stays pinned to the top of the screen.

Now this all works fantastic and you can scroll through the results no problem but the issue I'm having that I can't get the scrollview to stay at the bottom of whatever content I'm throwing out there as it grows down. I thought the commented out line at the end of the code block would do that but nothing I'm trying seems to do anything. I can reliably move the view to the top of the scrollable area but is there any way to easily move the viewable window in a scrollview to the bottom of its content?


e: to give a bit more context, here is what the final output looks like. as files are being processe i'm writing various status updates to the screen. this is just a simple label inside of a scrollview both of which i'm resizing dynamically as content is being created

Yodzilla fucked around with this message at 15:49 on Sep 28, 2012

Doh004
Apr 22, 2007

Mmmmm Donuts...

Doh004 posted:

That did something!

Now the word "moves to the left" and gets cut off. So "Capitalization" turns into "italization". Any idea?

Ended up finding this on Stackoverflow: http://stackoverflow.com/questions/4382976/multiline-uilabel-with-adjustsfontsizetofitwidth

It loops through the set frame size and decrements the font size until it fits within the bounds. I thought something like this would have already been implemented for it, but I guess not!

Thanks for the help though guys, and I'll probably have a lot more questions.

tarepanda
Mar 26, 2011

Living the Dream
Solved my previous problems, now a new one rears its head...

AVCaptureSessionPresets are inconsistent, apparently.

If I use AVCaptureSessionPresetHigh on the iPad 3, I get a crappy 1080 image with a tight field of view, so I have to use AVCaptureSessionPresetPhoto, which the documentation says "Specifies capture settings suitable for high resolution photo quality output."

That's fine.

Now, if I go back to an iPad 2:
AVCaptureSessionPresetPhoto -- 960 x 720
AVCaptureSessionPresetHigh -- 1280 x 720

This is the OPPOSITE of the iPad 3, where Photo is higher-quality than High.

And then on the iPhone 4S:
AVCaptureSessionPresetPhoto -- 852 x 620
AVCaptureSessionPresetHigh -- 1920 x 1080
Real photo: 3264 x 2448

This wouldn't matter as much if I could get AVCaptureVideoDataOutput to work at the same time as AVCaptureStillImageOutput -- I need the video data for frame-by-frame processing/analysis, but the still image output is what gives me a real picture taken by the camera instead of a screen grab... aggh.

tarepanda fucked around with this message at 09:36 on Sep 29, 2012

Doc Block
Apr 15, 2003
Fun Shoe
It has to do with video vs photo. For video, the camera isn't using the full sensor, but rather a 1080p (or 720p) section in the center of the sensor, which is why it looks more zoomed in.

For the photo presets, you're getting the full sensor. To keep things quick, though, the video output isn't the sensor's full resolution, because its just meant for preview anyway. The still output will get you the sensor's full resolution.

You're aware that you can have both the video and still image outputs hooked up at the same time, right?

edit: it really really helps to read Apple's AVFoundation programming guide.

Doc Block fucked around with this message at 20:07 on Sep 29, 2012

tarepanda
Mar 26, 2011

Living the Dream

Doc Block posted:


You're aware that you can have both the video and still image outputs hooked up at the same time, right?

edit: it really really helps to read Apple's AVFoundation programming guide.

I read the guide and didn't see anything about using them simultaneously... and when I tried it myself, it didn't work at all.

I also spent a long time yesterday fighting with it and looking for other people who've done it and really didn't find anyone who had -- the most common comments were "save the video frame" and "tough poo poo."

tarepanda fucked around with this message at 23:18 on Sep 29, 2012

Doc Block
Apr 15, 2003
Fun Shoe
I think it requires iOS 5 or above, but I do it in a current app. You just ask the still image output to take a still photo when you want one, and the video output keeps pumping out frames all the while.

I'm actually breaking my camera functionality out into a separate class (my app has the AVFoundation stuff mixed into the view controller and it's kind of messy), maybe I'll post what I've got in a bit.

tarepanda
Mar 26, 2011

Living the Dream
That would be really helpful if you could.

Doc Block
Apr 15, 2003
Fun Shoe
Ok, here it is.

It works back to iOS 5 and requires ARC. Seems to work well enough, but tap-to-focus/tap-to-expose aren't functional yet, and it doesn't handle autorotation very well (it only likes portrait).

tarepanda
Mar 26, 2011

Living the Dream

Doc Block posted:

(it only likes portrait).

I wonder if that might be a part of why I couldn't get it to work right... I force everything to be in landscape.

Edit: I forgot -- thank you! I appreciate you sharing your code. It's Monday now, so I'm going to look at it closer and see if I can solve my own problem. If I figure out a way around the landscape problems, I'll let you know.

Edit 2: I hope this helps you -- god knows you've helped me enough over the last few pages. This works for me. Might not be the prettiest, but it works. Set up a notification...

code:
    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [notificationCenter addObserver:self
                           selector:@selector(deviceOrientationChanged)
                               name:UIDeviceOrientationDidChangeNotification
                             object:nil];
And then check the interface for orientation before changing.

code:
- (void)deviceOrientationChanged
{
    UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
     
    if(orientation == 0){ // default
        _previewLayer.orientation = AVCaptureVideoOrientationPortrait;
    }else if(orientation == UIInterfaceOrientationPortrait &&
             _previewLayer.orientation != AVCaptureVideoOrientationPortrait){
        _previewLayer.orientation = AVCaptureVideoOrientationPortrait;
    }else if(orientation == UIInterfaceOrientationLandscapeLeft &&
             _previewLayer.orientation != AVCaptureVideoOrientationLandscapeLeft){
        _previewLayer.orientation = AVCaptureVideoOrientationLandscapeLeft;
    }else if(orientation == UIInterfaceOrientationLandscapeRight &&
             _previewLayer.orientation != AVCaptureVideoOrientationLandscapeRight){
        _previewLayer.orientation = AVCaptureVideoOrientationLandscapeRight;
    }else if(orientation == UIInterfaceOrientationPortraitUpsideDown &&
             _previewLayer.orientation != AVCaptureVideoOrientationPortraitUpsideDown){
        _previewLayer.orientation = AVCaptureVideoOrientationPortraitUpsideDown;
    }
}
I was getting screwy results when I was checking against device orientation -- the orientation would constantly flicker even if I didn't actually move the device in a way that would merit an orientation change. This is much more stable and works fine for me so far. Better still, the video is guaranteed to be oriented correctly with respect to the interface, which is what you want.

I purposefully left out an else at the end because those are the only four orientations you'd reasonably want to change for.

tarepanda fucked around with this message at 01:21 on Oct 2, 2012

Built 4 Cuban Linux
Jul 15, 2007

i own america
I've been doing most of my work on a 13" MacBook Air (I love coding on the couch) and I really wish Apple had a simulator for a non-Retina 4" display. I know it wouldn't actually exist, but it would be nice to test for that aspect ratio with something that actually fits on screen.

Doc Block
Apr 15, 2003
Fun Shoe
You can scale the window down, it's under the Window menu in the simulator.

Built 4 Cuban Linux
Jul 15, 2007

i own america

Doc Block posted:

You can scale the window down, it's under the Window menu in the simulator.

Oh man, fantastic. Thank you.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
There's also a menu item for the home button, which comes in handy as scaled simulator windows lose their chrome.

NoDamage
Dec 2, 2000

Built 4 Cuban Linux posted:

I've been doing most of my work on a 13" MacBook Air (I love coding on the couch) and I really wish Apple had a simulator for a non-Retina 4" display. I know it wouldn't actually exist, but it would be nice to test for that aspect ratio with something that actually fits on screen.
I'm using a 13" MacBook Air to work on a retina version of a Mac app. Testing it is hilarious cause in high DPI emulation mode the screen has an effective resolution of 720x450.

I wish they did something that allowed the entire screen to scroll to emulate a high DPI display, instead of just shrinking it to effectively 1/4 the size.

Doh004
Apr 22, 2007

Mmmmm Donuts...
Sup developing on 13" Air buddies :respek:

Noobie question: I want to draw a straight line (think of the equivalent of the <hr> tag in HTML). Is really the best/easiest way to do this to create a UIView and set its background color?

Hughlander
May 11, 2005

What's the best way to save small pieces of data that can change several times? I have a long running app that would like to save about 10 pieces of data one at a time in the first minute of it's run-time and reload it at a later date. None of the data is more than about 1k, but it's important that the save happens at the time that it's triggered rather than being batched up until later.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Doh004 posted:

Noobie question: I want to draw a straight line (think of the equivalent of the <hr> tag in HTML). Is really the best/easiest way to do this to create a UIView and set its background color?

Given the total lack of context, that sounds about right. If you could go into a bit more detail about what you're trying to do, there may be a more appropriate solution.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Hughlander posted:

What's the best way to save small pieces of data that can change several times? I have a long running app that would like to save about 10 pieces of data one at a time in the first minute of it's run-time and reload it at a later date. None of the data is more than about 1k, but it's important that the save happens at the time that it's triggered rather than being batched up until later.

First thing that comes to mind is NSUserDefaults, you can give it arrays, dictionaries, strings, numbers, dates, and arbitrary binary data. Send it the -synchronize message and it should save right then.

If that's not enough control, maintain a file somewhere and save it when you need to.

If you're going between devices, use the iCloud key value store.

Doh004
Apr 22, 2007

Mmmmm Donuts...

pokeyman posted:

Given the total lack of context, that sounds about right. If you could go into a bit more detail about what you're trying to do, there may be a more appropriate solution.

Say I'm building up a simple UIView. I place in a UILabel, and I want to draw a simple horizontal line underneath it.

tarepanda
Mar 26, 2011

Living the Dream
I'm using ALAssetsLibrary to save pictures and that requires location permissions (due to the EXIF information in the photos, I assume) -- is there a way to ask for that permission the first time I start up rather than the first time a picture is saved?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Doh004 posted:

Say I'm building up a simple UIView. I place in a UILabel, and I want to draw a simple horizontal line underneath it.

Yeah, I'd go with a little view with a background color. Use constraints to make sure it stays just underneath the label and you're set.

Doc Block
Apr 15, 2003
Fun Shoe

tarepanda posted:

I'm using ALAssetsLibrary to save pictures and that requires location permissions (due to the EXIF information in the photos, I assume) -- is there a way to ask for that permission the first time I start up rather than the first time a picture is saved?

Access the photo library at an earlier time? I don't know if that's OK with apple, though.

Doc Block fucked around with this message at 05:42 on Oct 3, 2012

tarepanda
Mar 26, 2011

Living the Dream

Doc Block posted:

access the photo library at an earlier time? I don't know if that's OK with apple, though.

Yeah, I do that now and I'm not sure how happy they'd be with a meaningless access at the beginning...

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
You can use CoreLocation to check the current permission status and specifically request permission, but it's probably not really worth the effort.

I would blow Dane Cook
Dec 26, 2008
I feel the need to confess my sins: Most of my problems in iOS development are caused by me forgetting to link things up in interface builder.

tarepanda
Mar 26, 2011

Living the Dream
I'm getting really, really fed up with Apple's library and how long it takes to save photos to specific albums.

Will Apple kill me if I start just saving them in the Documents folder?

leveltenpaladin
Feb 18, 2009

Jumpingmanjim posted:

I feel the need to confess my sins: Most of my problems in iOS development are caused by me forgetting to link things up in interface builder.

I've done this more times than I care to admit. The majority of the remaining problems I have are when I successfully hook up the IBAction but fail to actually implement the method to push the next view (or whatever the control was supposed to do).

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

tarepanda posted:

I'm getting really, really fed up with Apple's library and how long it takes to save photos to specific albums.

Will Apple kill me if I start just saving them in the Documents folder?
Adding assets to albums is really awesome because fetching the album requires giving it a chance to invalidate the asset (or vice-versa if you do it in the other order), and there isn't actually any guarantee that you'll ever be able to have both a valid asset and a valid album at the same time.

What I ended up doing was writing images to a cache directory and adding stuff in that directory to the library on a background thread, which Apple did not object to.

tarepanda
Mar 26, 2011

Living the Dream
That's what I'm doing now -- my issue was/is that if I try saving directly to the album and they change the view before it actually does that, the photo ends up not being saved.

Plus we're unsure if we want users to be able to delete files or not (record-keeping), so if we do everything in-bundle (saving photos, in-app gallery), we'd be able to control that, too...

Doh004
Apr 22, 2007

Mmmmm Donuts...
We're currently trying to determine if we (our company) can use Testflight due to legal issues. In the mean time, I'm trying to do OTA ad hoc distribution of our app to our other developers/designers, but none of this poo poo wants to work.

I've googled a bit and found some tutorials that are out of date or don't seem to work. Anyone have a guide that they've used in the past for ad hoc distribution manually?

Adbot
ADBOT LOVES YOU

Vashro
May 12, 2004

Proud owner of Lazy Lion #46
Okay, so I've been doing some more research on a relatively inexpensive Macbook.

Found this. . Model number MC516LL/A

Now although it does come shipped with Snow Leopard, the part number is listed under Apple's qualifying models for a Mountain Lion upgrade.

My question is really this: is this laptop capable of running xcode and submitting apps? If not, if anybody has economical alternatives I am all ears!

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