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
Dog on Fire
Oct 2, 2004

LP0 ON FIRE posted:

“Certificate status: Good” for both Apple IDs

Alright, Good then!

Adbot
ADBOT LOVES YOU

LP0 ON FIRE
Jan 25, 2006

beep boop
See my updates in my last post. The Evaluation Status is saying different things sometimes.

Dog on Fire
Oct 2, 2004

My developer cert also has "No root certificate found" as "Evaluation Status", so I don't think that's the problematic part ...

Dog on Fire fucked around with this message at 20:49 on Feb 21, 2018

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Froist posted:

"Comedy" becomes "most likely to work" unless you're part of a team.

Agreed. Probably should’ve checked if it was a solo or team situation.

LP0 ON FIRE
Jan 25, 2006

beep boop

pokeyman posted:

Agreed. Probably should’ve checked if it was a solo or team situation.

It says team but solo makes sense for me.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

LP0 ON FIRE posted:

It says team but solo makes sense for me.

Sorry I’m being unclear, I meant solo/team as in number of people involved, not the dev portal concept of "team".

LP0 ON FIRE
Jan 25, 2006

beep boop

pokeyman posted:

Sorry I’m being unclear, I meant solo/team as in number of people involved, not the dev portal concept of "team".

lol

LP0 ON FIRE
Jan 25, 2006

beep boop
e: Think I found a pretty good tutorial. Still creating it. https://www.patreon.com/posts/create-ios-xcode-10361342

Is there a built in UI element similar to the one on the bottom of the camera app where you select video/photo/square? Kind of like a sideways picker view. The closest I can find is the page control element with the dots.

LP0 ON FIRE fucked around with this message at 17:14 on Feb 26, 2018

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I can’t think of one. I’ve seen people make similar controls using a custom collection view layout, might be some code on GitHub that does that.

LP0 ON FIRE
Jan 25, 2006

beep boop
What was mentioned in that video tutorial was great and was simple enough to not use one that is already made. The only thing that didn't work for me was setting the label and view's size that are added to the UIPickerView in pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView

Instead, I used pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat to return a height for each row.

Dog on Fire
Oct 2, 2004

This is a somewhat stupid question, but: I can edit an App ID in Developer Center and it won't break the build that's already in App Store, right? I need to add the Associated Domains capability to an App ID and there is a version of the app already in App Store.

Typing this out I see how all apps would break all the time if this would be a problem, and last I read up on this, Apple stuck their own separate provisioning profile into the App Store version anyway, so there really shouldn't be any way this could affect the version in the store, but I thought I'd ask just in case.

Doh004
Apr 22, 2007

Mmmmm Donuts...
You should be fine as long as you aren't editing the actual App ID, which I don't even know if you can?

Same thing goes for provisioning profile + certs, won't affect current App Store listings.

Dog on Fire
Oct 2, 2004

Doh004 posted:

You should be fine as long as you aren't editing the actual App ID, which I don't even know if you can?

Same thing goes for provisioning profile + certs, won't affect current App Store listings.

Yeah, there is no way to edit the actual ID. Only the App ID’s title and capabilities.

I kind of wonder what would happen if I would delete the App ID. If it would actually let me delete it before removing the app from iTunes Connect and so on. :)

LP0 ON FIRE
Jan 25, 2006

beep boop
edit: Sorry I always post here way too soon but I swear I feel hopeless and out of answers. I think I got it, though I don't know if it is technically correct. I check if it's cancelled to break out of the loop. But why do I need to? Isn't it cancelled so it should handle that itself?:
code:
recordedTimeQueue = DispatchWorkItem {
for i in 1 ..< (600) { // 600 max seconds
	if(recordedTimeQueue?.isCancelled)! { break }
		usleep(1000000)
		DispatchQueue.main.async {
			recordedTime?.text = "\(i)"
		}
	}
}
I have a DispatchWorkItem I'm trying to invalidate. I can see when my timer runs after it is stopped, I have an additional timer updating the text.

code:
recordedTimeQueue = DispatchWorkItem {
	for i in 1 ..< (600) { // 600 max seconds
        	usleep(1000000)
                DispatchQueue.main.async {
                    recordedTime?.text = "\(i)"
                }
        }
}

DispatchQueue.global().async(execute: recordedTimeQueue!)
When I stop it:

code:
print("recording stopped")
			
recordedTimeQueue?.cancel()
I even tried making recordedTimeQueue nil.

One guess I might have is that I need to create a global bool so I can optionally return out of the for loop, but I don't know why this would be required.

LP0 ON FIRE fucked around with this message at 18:20 on Mar 23, 2018

LP0 ON FIRE
Jan 25, 2006

beep boop
I was having slowdown problems that I thought was from my video capture DispatchWorkItem updating the text, but it looks like it has to do with attempting a video capture multiple times eventually with this crash message: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[AVAssetWriterInputPixelBufferAdaptor appendPixelBuffer:withPresentationTime:] Must start a session (using -[AVAssetWriter startSessionAtSourceTime:) before appending pixel buffers'

LP0 ON FIRE fucked around with this message at 21:00 on Mar 23, 2018

Doh004
Apr 22, 2007

Mmmmm Donuts...

LP0 ON FIRE posted:

I was having slowdown problems that I thought was from my video capture DispatchWorkItem updating the text, but it looks like it has to do with attempting a video capture multiple times eventually with this crash message: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[AVAssetWriterInputPixelBufferAdaptor appendPixelBuffer:withPresentationTime:] Must start a session (using -[AVAssetWriter startSessionAtSourceTime:) before appending pixel buffers'

I haven't had the opportunity to use the new Dispatch APIs, but my hot take on all of this:

- Don't do things on the main thread if you don't need to
- Use the built in APIs to check if a worker has been cancelled to break out of the loop

This seems like a good blog post about it: https://medium.com/@yostane/swift-sweet-bits-the-dispatch-framework-ios-10-e34451d59a86

Dog on Fire
Oct 2, 2004

LP0 ON FIRE posted:

I check if it's cancelled to break out of the loop. But why do I need to? Isn't it cancelled so it should handle that itself?

I guess the work item, if it has started, will finish even if you cancel it midway. Which for me kind of makes sense because having a piece of code stopping at a random position would usually lead to all sorts of nasty things, so I’d say this really can’t happen automatically and we just have to do the stopping ourselves when we need to.

LP0 ON FIRE
Jan 25, 2006

beep boop

Dog on Fire posted:

I guess the work item, if it has started, will finish even if you cancel it midway. Which for me kind of makes sense because having a piece of code stopping at a random position would usually lead to all sorts of nasty things, so I’d say this really can’t happen automatically and we just have to do the stopping ourselves when we need to.


Doh004 posted:

I haven't had the opportunity to use the new Dispatch APIs, but my hot take on all of this:

- Don't do things on the main thread if you don't need to
- Use the built in APIs to check if a worker has been cancelled to break out of the loop

This seems like a good blog post about it: https://medium.com/@yostane/swift-sweet-bits-the-dispatch-framework-ios-10-e34451d59a86

I've been breaking out of the loop with isCancelled, which makes my timer I was having trouble with before work correctly now, but it looks like the problem is that it somehow sees that I'm not starting a session before appending it if I stop and reattempt several videos in a row. I'm stepping through it and don't see how what it's saying is possible.

Thanks for the link. There's some stuff in there I'm not familiar with, so I'll go through it and see if anything helps.

LP0 ON FIRE fucked around with this message at 18:17 on Mar 26, 2018

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
That is a canonical example of the kind of issue that can magically disappear when you attach a debugger or add a few print()s, so be wary of anything suddenly "fixing" itself.

Stringent
Dec 22, 2004


image text goes here

pokeyman posted:

That is a canonical example of the kind of issue that can magically disappear when you attach a debugger or add a few print()s, so be wary of anything suddenly "fixing" itself.

Can't quote this hard enough.

LP0 ON FIRE
Jan 25, 2006

beep boop
I THINK I fixed it, although I don't want to say I'm sure until it's been tested for a while. But usually it was after I made a video about 15 or 16 times, and so far I can go way past that without the video player being invisible or having session not started crashes.

All it took was making the player layer nil when exiting the view. I also have this wrapped in an asynchronous queue still from before which I saw suggested, and it doesn't seem to hurt.

code:
DispatchQueue.main.async(){
	self.player?.pause()
	self.playerLayer?.removeFromSuperlayer()
	self.playerLayer = nil
	self.player = nil
}

lord funk
Feb 16, 2004

All of my iPads touch screens are broken. The touch events glitch out and phantom touches speckle the screen. This is so infuriating to work with.

edit: it's being aggravated by the USB connection. Disconnecting it more or less stops the glitching out. gently caress me.

lord funk fucked around with this message at 21:56 on Apr 1, 2018

Doctor w-rw-rw-
Jun 24, 2008
Maybe weird voltage problems? Try switching power adapters?

I used to have phantom glitches and electric shocks on some of my iOS devices and the common factor was the charger. I have no idea whether this is at all the proper cause though.

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

lord funk posted:

All of my iPads touch screens are broken. The touch events glitch out and phantom touches speckle the screen. This is so infuriating to work with.

edit: it's being aggravated by the USB connection. Disconnecting it more or less stops the glitching out. gently caress me.

This is a known issue with cheap chargers and with grounding problems. Make sure your computer is using the three-prong grounded power cable. Use a $5 outlet tester to make sure your outlet is wired up correctly. If using charging bricks, make sure they’re official Apple ones.

LP0 ON FIRE
Jan 25, 2006

beep boop
Right now I have a "touch to focus and set exposure" feature on my camera app. How can I have the best of both worlds much like Apple's camera app where it both auto focuses and can touch to focus?

I have a Stack Overflow thread about it: https://stackoverflow.com/questions/49541837/swift-autofocus-expose-and-continuousautofocus-exposure-at-the-same-time

It's kind of hard for me to imagine how this works, but I guess it checks how much the cameras input changes. I see that there is a custom exposure mode (and something similar with focus I think), but I haven't seen many good examples of how this works together.

lord funk
Feb 16, 2004

Simulated posted:

This is a known issue with cheap chargers and with grounding problems. Make sure your computer is using the three-prong grounded power cable. Use a $5 outlet tester to make sure your outlet is wired up correctly. If using charging bricks, make sure they’re official Apple ones.

You know, I really wish someone had mentioned this 'known issue' when I took in two of my iPads for repair. They were sent in and the techs basically shrugged it off.

I'll check the grounding. It's connected to my 2013 Mac Pro in a room with isolated grounded outlets, but maybe the power strip is dying. Thanks.

Dog on Fire
Oct 2, 2004

We have an enterprise app that has this expiration date in its embedded.mobileprovision:
code:
<key>ExpirationDate</key>
<date>2018-01-06T08:21:41Z</date>
And indeed people were unable to install it. I created a new provisioning profile in Developer Center and resigned the app.

But I just discovered that I can install the old app with the expired ExpirationDate just fine on my iOS 11.2.6 iPhone and iPad. I've deleted the existing app, restarted my iPad and tried installing it then – same thing. I can't test it on other devices anymore today and I'm prepared to find out that it's something really dumb like I'm still somehow using the resigned app ... But I really don't think so.

This shouldn't happen, right? I shouldn't be able to install an app with an expired provisioning profile?

What's more, I hear that people can't install the resigned app on an iOS 9 iPad because they're getting the entitlement mismatch error. Until now I thought that they were still somehow trying to install the non-resigned app, but now I'm not sure that it's not just my overly free-spririted iOS 11 device letting me install all sorts of broken provisioning profiles and them seeing the errors like they're supposed to.

Dog on Fire fucked around with this message at 22:14 on Apr 5, 2018

CuddlyZombie
Nov 6, 2005

I wuv your brains.

I'm working on a coding challenge where I have to implement lazy loading of images for UITableViewCells without the aid of third-party libraries, and it is driving me bonkers. I load the image in a background thread, then call for it to be assigned in the main thread to cell.imageView.image, but the cell doesn't update and my computer keeps crashing and blugh. I can post my code once my laptop reboots if it'll help but I'm wondering if there's something fundamentally wrong with my approach. I'm guessing the cell doesn't get updated since its not being actively dequeued, would I be on the right track?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

CuddlyZombie posted:

I'm working on a coding challenge where I have to implement lazy loading of images for UITableViewCells without the aid of third-party libraries, and it is driving me bonkers. I load the image in a background thread, then call for it to be assigned in the main thread to cell.imageView.image, but the cell doesn't update and my computer keeps crashing and blugh. I can post my code once my laptop reboots if it'll help but I'm wondering if there's something fundamentally wrong with my approach. I'm guessing the cell doesn't get updated since its not being actively dequeued, would I be on the right track?

That’s what the third party libraries do. Why not look one up and check it?

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

CuddlyZombie posted:

I load the image in a background thread, then call for it to be assigned in the main thread to cell.imageView.image, but the cell doesn't update and my computer keeps crashing and blugh.

Your computer keeps crashing? As in, it freezes or brings up the panic overlay?

Nothing you’re doing should cause that unless you have crazy hacks (i.e. drivers) installed.

Or is there some other symptom?

CuddlyZombie
Nov 6, 2005

I wuv your brains.

pokeyman posted:

That’s what the third party libraries do. Why not look one up and check it?

You know, that's a really good idea.

Once I get some sleep, that's exactly what I will do, thanks!

eschaton posted:

Your computer keeps crashing? As in, it freezes or brings up the panic overlay?

Nothing you’re doing should cause that unless you have crazy hacks (i.e. drivers) installed.

Or is there some other symptom?

Oh, it has nothing to do with what I'm doing, I think it has to do with the battery or something, I need to take it in for a repair most likely. It just is contributing to me being unable to focus. :shobon:

Froist
Jun 6, 2004

CuddlyZombie posted:

I'm working on a coding challenge where I have to implement lazy loading of images for UITableViewCells without the aid of third-party libraries, and it is driving me bonkers. I load the image in a background thread, then call for it to be assigned in the main thread to cell.imageView.image, but the cell doesn't update and my computer keeps crashing and blugh. I can post my code once my laptop reboots if it'll help but I'm wondering if there's something fundamentally wrong with my approach. I'm guessing the cell doesn't get updated since its not being actively dequeued, would I be on the right track?

The cell should get redrawn when you change the ImageView's image. There could be a few things wrong:
  • Are you properly dispatching back to the main thread to update the image?
  • Do you have placeholder images? Do these show up prior to the lazy loading if you scroll quickly?
  • Are you using standard cells or a custom one? If custom, is it correctly adjusting the layout when the image changes?

Dog on Fire
Oct 2, 2004

Dog on Fire posted:

We have an enterprise app that has this expiration date in its embedded.mobileprovision:
code:
<key>ExpirationDate</key>
<date>2018-01-06T08:21:41Z</date>
And indeed people were unable to install it. I created a new provisioning profile in Developer Center and resigned the app.

But I just discovered that I can install the old app with the expired ExpirationDate just fine on my iOS 11.2.6 iPhone and iPad. I've deleted the existing app, restarted my iPad and tried installing it then – same thing. I can't test it on other devices anymore today and I'm prepared to find out that it's something really dumb like I'm still somehow using the resigned app ... But I really don't think so.

This shouldn't happen, right? I shouldn't be able to install an app with an expired provisioning profile?

What's more, I hear that people can't install the resigned app on an iOS 9 iPad because they're getting the entitlement mismatch error. Until now I thought that they were still somehow trying to install the non-resigned app, but now I'm not sure that it's not just my overly free-spririted iOS 11 device letting me install all sorts of broken provisioning profiles and them seeing the errors like they're supposed to.

So to me it seems that iOS itself keeps the provisioning profiles somewhere on the system, separately from the app itself, even after uninstalling the app. Because on a clean device I tested this scenario:
1. Install the old app with the expired embedded provisioning profile.
1.1. Result: the app wouldn't install with the reason "Entitlements blah blah blah".
2. Uninstall the expired app.
3. Install the resigned app (has the same app ID as the expired one).
3.1. Result: the app installed and ran successfully.
4. Uninstall the resigned app.
5. Install the old app with the expired embedded provisioning profile.
5.1. Result: the app installed and ran successfully.

LP0 ON FIRE
Jan 25, 2006

beep boop
Progress! :dance:

I figured out how to have touch focus and switch back to continuous focus when the scene changes. I'm so glad it's easy. Basically you want your device's isSubjectAreaChangeMonitoringEnabled property set to true, then create a notification that looks like this:

code:
NotificationCenter.default.addObserver(self,
selector: #selector(self.setDefaultFocusAndExposure),
name: NSNotification.Name.AVCaptureDeviceSubjectAreaDidChange,
object: nil)
To switch back to the default continuous mode in case the user was using touches and the scene dramatically changes.

I'm still having a few major issues I'm stumped with. One is trying to rotate a video after I record it. Or maybe set that while I'm recording it? I just don't know.

The other is getting my mic to record when recording video. I don't know why I'm so stumped with getting this to work. I think I'll put a debug UILabel to check db input level just to see if I'm getting any input in the first place.

LP0 ON FIRE fucked around with this message at 18:38 on Apr 6, 2018

CuddlyZombie
Nov 6, 2005

I wuv your brains.

Froist posted:

The cell should get redrawn when you change the ImageView's image. There could be a few things wrong:
  • Are you properly dispatching back to the main thread to update the image?
  • Do you have placeholder images? Do these show up prior to the lazy loading if you scroll quickly?
  • Are you using standard cells or a custom one? If custom, is it correctly adjusting the layout when the image changes?

Weird. I am dispatching back to the main thread to update the image, but I don't have a placeholder image. Maybe that will work. And I'm using a subclass of a UITableViewCell, with a storyboard prototype cell. The only change to the subclass is is has a UIActivityIndicatorView* property called spinner

What's interesting is that the images do show up once I dequeue new cells via scrolling, but the first cells viewed don't show images until they are removed from the screen and forced to reappear.
Here's my relevant code:

code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellIdentifier = @"Cell";
    UsersTableViewCell *cell = (UsersTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
    // Configure the cell...
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    
    NSDictionary *tempDictionary = [self.userArray objectAtIndex:indexPath.row];
    cell.textLabel.text = [tempDictionary objectForKey:@"display_name"];
    cell.detailTextLabel.text = [tempDictionary objectForKey:@"location"];
    
    
    //Set image to nil and have activityIndicator
    cell.imageView.image = nil;
    UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    spinner.hidesWhenStopped = YES;
    [spinner startAnimating];
    spinner.frame = cell.imageView.frame;
    UIView *parent = [cell.imageView superview];
    [parent addSubview:spinner];
    [parent bringSubviewToFront:spinner];
    cell.spinner = spinner;
    
    
    //Get image url as a string
    NSString *imgURLString = (NSString *)[tempDictionary objectForKey:@"profile_image"];
    if ([self.imageDictionary valueForKey:imgURLString]) {
        //load from cache
        cell.imageView.image = [self.imageDictionary valueForKey:imgURLString];
    }
    else
    {
        //save to cache
        [self performSelectorInBackground:@selector(downloadImage:) withObject:indexPath];
    }
    
    return cell;
}
- (void)downloadImage:(NSIndexPath *)path
{
    NSDictionary *tempDictionary = [self.userArray objectAtIndex:path.row];
    NSURL *url = [NSURL URLWithString:[tempDictionary objectForKey:@"profile_image"]];
    UIImage *loadedImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]];
    //save to cache
    [self.imageDictionary setObject:loadedImage forKey:[tempDictionary objectForKey:@"profile_image"]];
    dispatch_async(dispatch_get_main_queue(), ^{
        UsersTableViewCell *myCell = (UsersTableViewCell *)[self.tableView cellForRowAtIndexPath:path];
        myCell.imageView.image = loadedImage;
        [myCell.imageView reloadInputViews];
        [myCell.spinner stopAnimating];
    });
}

CuddlyZombie fucked around with this message at 07:41 on Apr 7, 2018

CuddlyZombie
Nov 6, 2005

I wuv your brains.

Ah! I figured it out! I had to replace the cell's subclass with a new imageView that wasnt the "default" imageView and hook that up in the prototype on the storyboard.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
You're also leaking a UIActivityIndicatorView every time a cell is reused.

dc3k
Feb 18, 2003

what.
You're also using KVC methods on a dictionary (valueForKey instead of objectForKey) in one spot, but not the others.

For array indices you can use array[index] rather than [array objectAt:index] and for dictionaries you can use dictionary[key] instead of [dictionary objectForKey:key] to make the code a bit nicer to read and ~ * more modern * ~

I know you didn't ask for code review but if "coding challenge" = "job interview takehome" this might help a bit.

dc3k fucked around with this message at 22:35 on Apr 8, 2018

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

dc3k posted:

For array indices you can use array[index] rather than [array objectAt:index] and for dictionaries you can use dictionary[key] instead of [dictionary objectForKey:key] to make the code a bit nicer to read and ~ * more modern * ~

Noticed a fun little historical edge case here the other day. The subscript methods are marked available as of iOS 6.0, so if your deployment target is 5.0 you get a warning. But if you enable ARC then you actually end up getting the subscript methods back to iOS 5, so the warning is spurious. Quieting the warning is less readable imo than switching to objectAtIndex/ForKey, however, so I ended up switching.

This didn’t really have anything to do with anything but I thought I’d share my story. Thanks for reading!

Adbot
ADBOT LOVES YOU

dc3k
Feb 18, 2003

what.
I like hearing about weird quirks like that. What were you working on that you wanted to target all the way back to iOS 5/6?

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