Post

Replies

Boosts

Views

Activity

Upload on background and updating live activities
Hello everyone, I'm developing a new feature that allows the user to keep track of a background upload through live activities. Im using the URLSessionTaskDelegate to keep track of the task progress and it works fine when the app is in foreground, but when the app goes to background, it stop after a few seconds. The upload still continues and Im able to receive updates on it's completion through the application(_ application: UIApplication, handleEventsForBackgroundURLSession but only through that. Also when I put the app back to foreground it updates to the correct progress so this is only happening in background. This is the URLSessionConfiguration I'm using: let config = URLSessionConfiguration.background(withIdentifier: "\(uploadBackgroundTaskIdentifier)") config.isDiscretionary = false config.allowsCellularAccess = true config.shouldUseExtendedBackgroundIdleMode = true config.sessionSendsLaunchEvents = true config.timeoutIntervalForResource = 28800 Does anyone knows how should I be able to keep track of the progress even when the app is in background?
3
0
853
Jul ’23
Card View Constraints
So, how to avoid constraint conflicts when setting subviews on a card view? When I add trailing and leading constraints to the content view, it always causes conflicts. Example: These are the constraints:  NSLayoutConstraint.activate([   comment.widthAnchor.constraint(greaterThanOrEqualToConstant: 250),          comment.heightAnchor.constraint(greaterThanOrEqualToConstant: 300),             userName.topAnchor.constraint(equalTo: comment.contentView.topAnchor, constant: 8),             userName.leadingAnchor.constraint(equalTo: comment.contentView.leadingAnchor, constant: 8),             userName.trailingAnchor.constraint(equalTo: comment.contentView.trailingAnchor, constant: -8),                          userScore.topAnchor.constraint(equalTo: userName.bottomAnchor, constant: 8),             userScore.leadingAnchor.constraint(equalTo: comment.contentView.leadingAnchor, constant: 8),             userScore.trailingAnchor.constraint(equalTo: comment.contentView.trailingAnchor, constant: -8),                          userComment.topAnchor.constraint(equalTo: userScore.bottomAnchor, constant: 8),             userComment.leadingAnchor.constraint(equalTo: comment.contentView.leadingAnchor, constant: 8),             userComment.trailingAnchor.constraint(equalTo: comment.contentView.trailingAnchor, constant: -8), userComment.bottomAnchor.constraint(lessThanOrEqualTo: comment.contentView.bottomAnchor, constant: -8) ]) This is the error: ( "<NSAutoresizingMaskLayoutConstraint:0x600003710140 h=--& v=--& UIView:0x7fd3dee31a10.width == 0   (active)>",     "<NSLayoutConstraint:0x60000372b570 H:|-(0)-[UIView:0x7fd3dee318a0]   (active, names: '|':UIView:0x7fd3dee31a10 )>",     "<NSLayoutConstraint:0x60000372b5c0 UIView:0x7fd3dee318a0.trailing == UIView:0x7fd3dee31a10.trailing   (active)>",     "<NSLayoutConstraint:0x60000372bd90 H:|-(8)-[UILabel:0x7fd3dee32bc0'Mark']   (active, names: '|':UIView:0x7fd3dee318a0 )>",     "<NSLayoutConstraint:0x60000372bde0 UILabel:0x7fd3dee32bc0'Mark'.trailing == UIView:0x7fd3dee318a0.trailing - 8   (active)>" ) Will attempt to recover by breaking constraint  <NSLayoutConstraint:0x60000372bde0 UILabel:0x7fd3dee32bc0'Mark'.trailing == UIView:0x7fd3dee318a0.trailing - 8   (active)> Can anyone explain me why this occurs?
2
0
665
Jun ’20
Top Shelf Carrousel Details
So, I've been working with a top shelf carrousel full screen example, but the details are never showed. Not even on the provided example - https://developer.apple.com/documentation/tvservices/building_a_full_screen_top_shelf_extension from session 211 - https://developer.apple.com/videos/play/wwdc2019/211/. This is what I'm doing to construct the TVTopShelfCarouselItem public func createCarrouselItens() -> TVTopShelfCarouselItem {         let item = TVTopShelfCarouselItem(identifier: movie.identifier)         item.contextTitle = NSLocalizedString("Featured Movie", comment: "The context title for a movie item.")         item.title = movie.title         item.summary = movie.summary         item.genre = movie.genre         item.duration = movie.duration         item.creationDate = movie.releaseDate         item.previewVideoURL = movie.previewVideoURL         item.mediaOptions = [.videoResolution4K]         item.namedAttributes = makeCarouselNamedAttributes()         item.setImageURL(movie.imageURL(withScale: 1), for: .screenScale1x)         item.setImageURL(movie.imageURL(withScale: 2), for: .screenScale2x)         setupAction(for: item)                  return item     } And on the loadTopShelfContent I'm doing this: let itens = Movie.mockedMovies().map { ContentBuilder(movie: $0).createCarrouselItens() } let content = TVTopShelfCarouselContent(style: .details, items: itens) Has anyone being through that and knows how to solve it?
1
0
557
Jun ’20