Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Performing I/O on the main thread can cause slow launches. #340

Open

Description

Xcode is producing many warnings re performance could be slow.

TSKBackgroundReporter.m

The else block below.

else {
 // Get the vendor identifier
 _appVendorId = identifier_for_vendor();
 
 
 // We're not running unit tests - use a background session
 // AppleDoc (currently 10.3) state that multiple background sessions with the same
 // identifier should never be created, so ensure that cannot happen by creating
 // a unique ID per instance.
 NSString *backgroundSessionId = [NSString stringWithFormat:kTSKBackgroundSessionIdentifierFormat,
 _appBundleId, [[NSUUID UUID] UUIDString]];
 
 NSURLSessionConfiguration *backgroundConfiguration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:backgroundSessionId];
 backgroundConfiguration.discretionary = YES;
 backgroundConfiguration.sharedContainerIdentifier = sharedContainerIdentifier;
 
#if TARGET_OS_IPHONE
 // iOS-only settings
 // Do not wake up the App after completing the upload
 backgroundConfiguration.sessionSendsLaunchEvents = NO;
#if !TARGET_OS_TV && !TARGET_OS_WATCH
 // on iOS (but not tvOS or watchOS), enable multipath
 backgroundConfiguration.multipathServiceType = NSURLSessionMultipathServiceTypeHandover;
#endif
#endif
 
 // We have to use a delegate as background sessions can't use completion handlers
 _backgroundSession = [NSURLSession sessionWithConfiguration:backgroundConfiguration
 delegate:self
 delegateQueue:nil];
 }

This is the below 2 lines.

  • NSURLSessionConfiguration *backgroundConfiguration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:backgroundSessionId]
  • _backgroundSession = [NSURLSession sessionWithConfiguration:backgroundConfiguration

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /