Git Product home page Git Product logo

gtm-session-fetcher's Introduction

Google Toolbox for Mac - Session Fetcher

Project site https://github.com/google/gtm-session-fetcher
Discussion group http://groups.google.com/group/google-toolbox-for-mac

SwiftPM CocoaPods

GTMSessionFetcher makes it easy for Cocoa applications to perform http operations. The fetcher is implemented as a wrapper on NSURLSession, so its behavior is asynchronous and uses operating-system settings.

Features include:

  • Simple to build; only one source/header file pair is required
  • Simple to use: takes just two lines of code to fetch a request
  • Supports upload and download sessions
  • Flexible cookie storage
  • Automatic retry on errors, with exponential backoff
  • Support for generating multipart MIME upload streams
  • Easy, convenient logging of http requests and responses
  • Supports plug-in authentication such as with GTMAppAuth
  • Easily testable; self-mocking
  • Automatic rate limiting when created by the GTMSessionFetcherService factory class
  • Fully independent of other projects

To get started please read USING.md for detailed information.

gtm-session-fetcher's People

Contributors

0xced avatar arcank avatar bhamiltoncx avatar dmaclach avatar fumoboy007 avatar gmrobbins avatar itf avatar karimhm avatar kuanfajardo avatar lukhnos avatar maksymmalyhin avatar maneesht avatar mega210 avatar mwyman avatar paulb777 avatar revolter avatar sdefresne avatar sergiocampama avatar thomasvl avatar welshm avatar williamdenniss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gtm-session-fetcher's Issues

Add target for static library

For iOS developers that wish to use this library in their application, and don't want to intermingle the source code, it would be great if the project contained a target for a static library.

warning: block implicitly retains 'self

  • WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:943:9: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:944:9: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:945:10: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:975:11: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:988:63: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:1041:60: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:1056:13: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:1057:31: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:1074:11: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:1825:40: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:2118:32: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:2120:10: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:2121:9: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:2125:66: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:2356:44: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:2362:17: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:2372:21: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:2488:25: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:2542:31: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:2545:52: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionFetcher.m:2606:25: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionUploadFetcher.m:1169:9: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionUploadFetcher.m:1216:13: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
    - WARN | [Firebase/Auth, Firebase/Invites, Firebase/Performance, and more...] xcodebuild: GTMSessionFetcher/Source/GTMSessionUploadFetcher.m:1639:13: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]

OS_dispatch_semaphore Memory Leak.

I am using firebase and I think gtm-session-fetcher was installed during firebase products installation. I am debugging my app for memory leaks and found out that "OS_dispatch_semaphore" which happened to be in gmt-session-fetcher file is causing the leak. Is there any solution or suggestion on how to solve this issue?

App was killed by system when in background mode

I start few sections upload files to GG Drive and then I press home button to move application to background mode.
About more than 30 seconds, I launch my app again and It was killed by watchdog.

And I double check in GTMSessionFetcher when it received backgroundTask exiprationHandler. If immediately I start new download request or in GTMSessionFetcher call uploadNextChunk of file. And GTMSessionFetch will create and start new backgroundTask.
So you try to start new backgroundTask after system through bgTask exiprationHandler, watchdog will kill my application

Path Manipulation

We have used GTMSessionFetcher 1.2.2 as per our need. Some VAPT points are mentioned in below picture. Kindly help us asap.

Issue Summary

Attackers are able to control the file system path argument to removeItemAtURL:error:() at GTMSessionUploadFetcher.m line 1540, which allows them to access or modify otherwise protected files.Attackers are able to control the file system path argument which allows them to access or modify otherwise protected files.

Issue Screenshot

Screenshot 2019-12-16 at 3 19 38 PM

Path Manipulation

Attackers are able to control the file system path argument to removeItemAtURL:error:() at GTMSessionUploadFetcher.m line 1565, which allows them to access or modify otherwise protected files.Attackers are able to control the file system path argument which allows them to access or modify otherwise protected files.

Reported by fortify on demand

Xcode 9 beta 1 curious error for [[self alloc] initWithDelegate]

GTMHTTPServer.m fails to compile with the following error:

"Multiple methods named 'initWithDelegate'."

It looks like the live issues processor can't deduce the correct class to use for self. Will wait for future versions of Xcode beta to see if it's fixed before filing a radar.

Feature request: support for metrics collection

The NSURLSessionTaskDelegate protocol has a new method -URLSession:task:didFinishCollectingMetrics: since iOS 10.0, which is invoked when metrics have been collected for the session. Users who are interested in things like connection time and transfer stats can then just rely on the information collected by the native network stack instead of rolling their own measurement routines.

It appears that one should make changes to GTMSessionFetcherSessionDelegateDispatcher as well as the downstream code path and introduce a new callback block type to the fetcher itself for those interested in getting the metrics information.

I have a proposed change and I'll make a pull request shortly.

sharedApplication is unavailable, not available on iOS (app extension).

Hello!

Our project is using Cocoapods 1.0.1 and following are part of the podspec.
pod 'GoogleAPIClient/Drive'
pod 'GTMOAuth2'
pod 'GTMSessionFetcher'

Which installs:

Using GTMOAuth2 (1.1.1)
Using GTMSessionFetcher (1.1.4)
Installing GoogleAPIClient 1.0.4 (was 1.0.3)

Upon build it ends in following error:

.../Pods/GTMSessionFetcher/Source/GTMSessionFetcher.m:1917:56: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.

.../Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:105:1: 'sharedApplication' has been explicitly marked unavailable here

File: GTMSessionFetcher.m

Line (1914 - 1920):
// Some projects use GTM_BACKGROUND_TASK_FETCHING to avoid compile-time references
// to UIApplication.
#if GTM_BACKGROUND_TASK_FETCHING
return (id<GTMUIApplicationProtocol>) [UIApplication sharedApplication];
#else
return nil;
#endif

Silence a performSelector-leaks warning.

Source/GTMReadMonitorInputStream.m:98:17: warning: performSelector may cause a leak because its selector is unknown [-Warc-performSelector-leaks]
[self performSelector:sel
^

Upload chunk fetchers create background tasks even with background sessions

The chunk fetchers using a background session still create background task identifiers. Because the upload is moved out of process, when the app is backgrounded the task identifier may not be released before the app runs out of time.

When GTMSessionUploadFetcher has .useBackgroundSessions=YES, GTMSessionFetcher .useBackgroundSession is not being set on chunk fetchers explicitly but being implied due to having a session identifier (sets .usingBackgroundSession=YES).

The test for whether to create a background task identifier only checks .useBackgroundSession. Should check .usingBackgroundSession instead.

Mac Catalyst Support

This library is using a number of APIs that are deprecated and that are unavailable on mac catalyst. Adding calls to newer APIs and appropriate availability checks and preprocessor checks to know when to use the newer APIs would allow supporting Catalyst, which would be nice!

Here are the errors:

Crash on silent push notification (Firebase Auth)

Using

Firebase 5.0.2 for iOS
FirebaseAuth
FirebaseUI/Auth
FirebaseUI/Phone

    FUIAuth *authUI = [FUIAuth defaultAuthUI];
    authUI.signInWithEmailHidden = YES;
    authUI.delegate = self;
    
    FUIPhoneAuth *provider= [[FUIPhoneAuth alloc] initWithAuthUI:authUI];
    authUI.providers = @[provider];
    [provider signInWithPresentingViewController:vc phoneNumber:mobileNumber];

Getting crashed (right after typing in phone number and taping 'Verify')

I understand it can be wrong use of GTMSessionFetcher in the Firebase Auth code, but also, crash happens inside this code: GTMSessionFetcherService fetcherDidBeginFetching:

Maybe you can suggest at least correct configuration for session fetcher to work properly?

Fatal Exception: NSInvalidArgumentException-[GTMSessionFetcher setFetcher:forTask:]: unrecognized selector sent to instance 0x10e429360 Raw Text
--
0 | CoreFoundation | __exceptionPreprocess
4 | CoreFoundation | _CF_forwarding_prep_0
5 | GTMSessionFetcher | GTMSessionFetcherService.m line 441-[GTMSessionFetcherService fetcherDidBeginFetching:]
6 | GTMSessionFetcher | GTMSessionFetcher.m line 894-[GTMSessionFetcher beginFetchMayDelay:mayAuthorize:]
7 | - | FIRAuthBackend.m line 545-[FIRAuthBackendRPCIssuerImplementation asyncPostToURLWithRequestConfiguration:URL:body:contentType:completionHandler:]
8 | - | FIRAuthBackend.m line 809-[FIRAuthBackendRPCImplementation postWithRequest:response:callback:]
9 | - | FIRAuthBackend.m line 701-[FIRAuthBackendRPCImplementation sendVerificationCode:callback:]
10 | - | FIRAuthBackend.m line 469+[FIRAuthBackend sendVerificationCode:callback:]
11 | - | FIRPhoneAuthProvider.m line 401__110-[FIRPhoneAuthProvider verifyClientAndSendVerificationCodeToPhoneNumber:retryOnInvalidAppCredential:callback:]_block_invoke.205
12 | - | FIRPhoneAuthProvider.m line 410-[FIRPhoneAuthProvider verifyClientWithCompletion:]
13 | - | FIRPhoneAuthProvider.m line 402-[FIRPhoneAuthProvider verifyClientAndSendVerificationCodeToPhoneNumber:retryOnInvalidAppCredential:callback:]
14 | - | FIRPhoneAuthProvider.m line 340__61-[FIRPhoneAuthProvider internalVerifyPhoneNumber:completion:]_block_invoke
15 | - | FIRAuthNotificationManager.m line 173-[FIRAuthNotificationManager callBack]
16 | - | FIRAuthNotificationManager.m line 146-[FIRAuthNotificationManager canHandleNotification:]
17 | - | FIRAuth.m line 1412__33-[FIRAuth canHandleNotification:]_block_invoke

-[GTMSessionFetcher setFetcher:forTask:]: unrecognized selector sent to instance 0x103009120

We're getting these crash reports on Crashlytics but we haven't been able to reproduce this error.

We use FirebaseAuth to anonymously sign-in users

Auth.auth().signInAnonymously() { (authResult, error) in

}
 
Fatal Exception: NSInvalidArgumentException
-[GTMSessionFetcher setFetcher:forTask:]: unrecognized selector sent to instance 0x103009120
-[GTMSessionFetcherService fetcherDidBeginFetching:]

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x1c009c96c __exceptionPreprocess
1  libobjc.A.dylib                0x1bfdb5028 objc_exception_throw
2  CoreFoundation                 0x1bff9adcc -[NSOrderedSet initWithSet:copyItems:]
3  CoreFoundation                 0x1c00a1048 ___forwarding___
4  CoreFoundation                 0x1c00a33a0 _CF_forwarding_prep_0
5  GTMSessionFetcher              0x101143c38 -[GTMSessionFetcherService fetcherDidBeginFetching:] + 445 (GTMSessionFetcherService.m:445)
6  GTMSessionFetcher              0x101137420 -[GTMSessionFetcher beginFetchMayDelay:mayAuthorize:] + 953 (GTMSessionFetcher.m:953)
7  Stickers                       0x100358e94 -[FIRAuthBackendRPCIssuerImplementation asyncPostToURLWithRequestConfiguration:URL:body:contentType:completionHandler:] + 582 (FIRAuthBackend.m:582)
8  Stickers                       0x10035a63c -[FIRAuthBackendRPCImplementation postWithRequest:response:callback:] + 863 (FIRAuthBackend.m:863)
9  Stickers                       0x10035915c -[FIRAuthBackendRPCImplementation getAccountInfo:callback:] + 612 (FIRAuthBackend.m:612)
10 Stickers                       0x100358230 +[FIRAuthBackend getAccountInfo:callback:] + 446 (FIRAuthBackend.m:446)
11 Stickers                       0x100370de8 __102+[FIRUser retrieveUserWithAuth:accessToken:accessTokenExpirationDate:refreshToken:anonymous:callback:]_block_invoke + 290 (FIRUser.m:290)
12 Stickers                       0x100374f34 __51-[FIRUser internalGetTokenForcingRefresh:callback:]_block_invoke + 989 (FIRUser.m:989)
13 Stickers                       0x10036e1e0 __65-[FIRSecureTokenService fetchAccessTokenForcingRefresh:callback:]_block_invoke + 111 (FIRSecureTokenService.m:111)
14 Stickers                       0x1003601d0 __38-[FIRAuthSerialTaskQueue enqueueTask:]_block_invoke + 51 (FIRAuthSerialTaskQueue.m:51)
15 libdispatch.dylib              0x1bfd40b7c _dispatch_call_block_and_release
16 libdispatch.dylib              0x1bfd41fd8 _dispatch_client_callout
17 libdispatch.dylib              0x1bfd48450 _dispatch_lane_serial_drain
18 libdispatch.dylib              0x1bfd48eb4 _dispatch_lane_invoke
19 libdispatch.dylib              0x1bfd48320 _dispatch_lane_serial_drain
20 libdispatch.dylib              0x1bfd48e7c _dispatch_lane_invoke
21 libdispatch.dylib              0x1bfd51f20 _dispatch_workloop_worker_thread
22 libsystem_pthread.dylib        0x1bfda76d0 _pthread_wqthread
23 libsystem_pthread.dylib        0x1bfdad9e8 start_wqthread
 

Log Forging

We have used GTMSessionFetcher 1.2.2 as per our need. Some VAPT points are mentioned in below picture. Kindly help us asap.

Issue Summary
The function beginFetchMayDelay:mayAuthorize:() in GTMSessionFetcher.m writes unvalidated user input to the log on line 796. An attacker could take advantage of this behavior to forge log entries or inject malicious content into the log.The identified function writes unvalidated user input to the log. An attacker could take advantage of this behavior to forge log entries or inject malicious content into the log.

Issue Summary
Screenshot 2019-12-24 at 4 25 39 PM

Use fetcher to download big files with api v3?

I tried to download a large file (>30mb). It is impossible simply to get webContentLink property value and to use it as a link in fetcherWithURLString: method. Because they show html page with a confirmation button.

gtm-session-fetcher has issues when installed through cocoapods

I'm running into an issue similar to google/google-api-objectivec-client#103, but with the gtm-session-fetcher.

Before I add the pod, my podfile looks like this

platform :ios, '8.0'
target 'emission' do
    project 'emission.xcodeproj'
    pod 'GoogleCloudMessaging', '~> 1.2.0'
    pod 'GGLInstanceID', '~> 1.2.1'
end

and my podfile.lock looks like this

PODS:
  - GGLInstanceID (1.2.1)
  - GoogleCloudMessaging (1.2.0):
    - GoogleInterchangeUtilities (~> 1.0)
    - GoogleIPhoneUtilities (~> 1.0)
    - GoogleSymbolUtilities (~> 1.0)
  - GoogleInterchangeUtilities (1.2.2):
    - GoogleSymbolUtilities (~> 1.1)
  - GoogleIPhoneUtilities (1.2.1):
    - GoogleSymbolUtilities (~> 1.0)
    - GoogleUtilities (~> 1.0)
  - GoogleSymbolUtilities (1.1.2)
  - GoogleUtilities (1.3.2):
    - GoogleSymbolUtilities (~> 1.1)

DEPENDENCIES:
  - GGLInstanceID (~> 1.2.1)
  - GoogleCloudMessaging (~> 1.2.0)

SPEC CHECKSUMS:
  GGLInstanceID: 4a317044f744281b82cd03015f379899f277cad3
  GoogleCloudMessaging: f37ea14dd0f41d4d889c10b5559dd35bbfd9ac26
  GoogleInterchangeUtilities: d5bc4d88d5b661ab72f9d70c58d02ca8c27ad1f7
  GoogleIPhoneUtilities: 63f25e93a3ddcb66884d182aab3a660d98f1479b
  GoogleSymbolUtilities: 631ee17048aa5e9ab133470d768ea997a5ef9b96
  GoogleUtilities: 8bbc733218aad26306f9d4a253823986110e3358

PODFILE CHECKSUM: 31ae123a6a1fde94fce2488f9662200bc8369937

COCOAPODS: 1.2.0

After I add the pod

platform :ios, '8.0'
target 'emission' do
    project 'emission.xcodeproj'
    pod 'GoogleCloudMessaging', '~> 1.2.0'
    pod 'GGLInstanceID', '~> 1.2.1'
    pod 'GoogleSignIn', '~> 4.0.0'
end

and run install

C02KT61MFFT0:ios shankari$ pod install
Analyzing dependencies
Downloading dependencies
Installing FirebaseAnalytics (3.6.0)
Installing FirebaseCore (3.4.7)
Installing FirebaseInstanceID (1.0.8)
Using GGLInstanceID (1.2.1)
Installing GTMOAuth2 (1.1.4)
Installing GTMSessionFetcher (1.1.8)
Installing Google (3.0.3)
Installing GoogleAppUtilities (1.1.2)
Using GoogleCloudMessaging (1.2.0)
Using GoogleIPhoneUtilities (1.2.1)
Using GoogleInterchangeUtilities (1.2.2)
Installing GoogleSignIn (4.0.1)
Using GoogleSymbolUtilities (1.1.2)
Installing GoogleToolboxForMac (2.1.1)
Using GoogleUtilities (1.3.2)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 3 dependencies from the Podfile and 15 total pods installed.

the Podfile.lock looks like this
Podfile.lock.txt

but when I try to compile, I get a bunch of errors like so:

In file included from /Users/shankari/e-mission/e-mission-phone/platforms/ios/emission/Plugins/edu.berkeley.eecs.emission.cordova.comm/BEMCommunicationHelper.m:12:
In file included from emission/Plugins/edu.berkeley.eecs.emission.cordova.comm/BEMCommunicationHelper.h:10:
In file included from /Users/shankari/e-mission/e-mission-phone/platforms/ios/build/emulator/GTMSessionFetcherService.h:23:
/Users/shankari/e-mission/e-mission-phone/platforms/ios/build/emulator/GTMSessionFetcher.h:497:3: note: previous definition is here
  GTMSessionFetcherStatusBadRequest = 400,

Segfault when setting TLSMinimumSupportedProtocolVersion

Running on iOS 13 I get a segfault when the GTMSessionFetcher sets _configuration.TLSMinimumSupportedProtocolVersion to tls_protocol_version_TLSv12

#if !GTM_ALLOW_INSECURE_REQUESTS
#if GTM_SDK_REQUIRES_TLSMINIMUMSUPPORTEDPROTOCOLVERSION
      _configuration.TLSMinimumSupportedProtocolVersion = tls_protocol_version_TLSv12;
#elif GTM_SDK_SUPPORTS_TLSMINIMUMSUPPORTEDPROTOCOLVERSION
      if (@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)) {
        _configuration.TLSMinimumSupportedProtocolVersion = tls_protocol_version_TLSv12;
      } else {
        _configuration.TLSMinimumSupportedProtocol = kTLSProtocol12;
      }
#else
      _configuration.TLSMinimumSupportedProtocol = kTLSProtocol12;
#endif  // GTM_SDK_REQUIRES_TLSMINIMUMSUPPORTEDPROTOCOLVERSION
#endif
2020-01-08 10:59:13.882012-0800 OctiDev[1713:2662800] -[__NSCFURLSessionConfiguration_Mutable setTLSMinimumSupportedProtocolVersion:]: unrecognized selector sent to instance 0x10cabe450
2020-01-08 10:59:13.882922-0800 OctiDev[1713:2662800] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFURLSessionConfiguration_Mutable setTLSMinimumSupportedProtocolVersion:]: unrecognized selector sent to instance 0x10cabe450'

Xcode 9.3 build warnings

/Users/paulbeusterien/gh/firebase-ios-sdk/Example/Pods/GTMSessionFetcher/Source/GTMSessionUploadFetcher.m:1411:29: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'int64_t' (aka 'long long') [-Wformat]
newOffset, self.currentOffset, previousContentLength,
^~~~~~~~~
In file included from /Users/paulbeusterien/gh/firebase-ios-sdk/Example/Pods/GTMSessionFetcher/Source/GTMSessionUploadFetcher.m:20:
In file included from /Users/paulbeusterien/gh/firebase-ios-sdk/Example/Pods/GTMSessionFetcher/Source/GTMSessionUploadFetcher.h:37:
/Users/paulbeusterien/gh/firebase-ios-sdk/Example/Pods/GTMSessionFetcher/Source/GTMSessionFetcher.h:301:69: note: expanded from macro 'GTMSESSION_ASSERT_DEBUG'
#define GTMSESSION_ASSERT_DEBUG(pred, ...) if (!(pred)) { NSLog(VA_ARGS); }
^~~~~~~~~~~
/Users/paulbeusterien/gh/firebase-ios-sdk/Example/Pods/GTMSessionFetcher/Source/GTMSessionUploadFetcher.m:1411:60: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'int64_t' (aka 'long long') [-Wformat]
newOffset, self.currentOffset, previousContentLength,
^~~~~~~~~~~~~~~~~~~~~
In file included from /Users/paulbeusterien/gh/firebase-ios-sdk/Example/Pods/GTMSessionFetcher/Source/GTMSessionUploadFetcher.m:20:
In file included from /Users/paulbeusterien/gh/firebase-ios-sdk/Example/Pods/GTMSessionFetcher/Source/GTMSessionUploadFetcher.h:37:
/Users/paulbeusterien/gh/firebase-ios-sdk/Example/Pods/GTMSessionFetcher/Source/GTMSessionFetcher.h:301:69: note: expanded from macro 'GTMSESSION_ASSERT_DEBUG'
#define GTMSESSION_ASSERT_DEBUG(pred, ...) if (!(pred)) { NSLog(VA_ARGS); }
^~~~~~~~~~~
2 warnings generated.

Support Swift Package Manager

Swift Package Manager is now built into Xcode and is already becoming widely adopted by 3rd party libraries. It would be great to see support for SPM here, as this would open up other google libraries (like GTLR) that depend on this library to also use SPM.

Build and Archive error

When I build from xcodeproject I got following error:

ld: library not found for -lGTMSessionFetcher
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It works fine in xworkspace, Unfortunately I can not Archive it says The operation could not complete no file or directory

React Native - Firebase

Progress is unreliable

Testing all with Google Drive:

  • GTMSessionFetcher.downloadedLength is 0 until the download finishes, instead of updating as more bytes are received
  • When using GTMSessionFetcher's downloadProgressBlock totalBytesExpectedToWrite is always 0 or -1.
  • GTMSessionFetcher's beginFetchWithCompletionHandler is returning nil NSData, even though it successfully saves the file to disk. Intentional?

Tested on iPhone 6, iOS 9.3.

Where do I find the built framework after a successful build?

I'm trying to include gtm-session-fetcher in my project. I am successfully able to get everything to work by copying source over and including it directly in my project, but obviously, it would be better from a modularity perspective to create a framework and include that directly.

So I opened the associated xcodeproj file and built the IOS framework. The build was successful (see below), but I don't see a build directory or a generated framework, either in the source directory or in /Library/Frameworks, which is the install path.

screen shot 2016-03-05 at 8 07 44 am

screen shot 2016-03-05 at 8 09 31 am

Where should I expect to find the built framework?

Don't Automatically Prettify JSON Data in Log

Prettifying JSON data for the log is nice, but there should at least be a way to turn it off since it can cause the data to change.

For example, you can post content that looks like this:

{"number":2.06}

but it will be logged as:

{
    "number" : 2.0600000000000001
}

This can cause problems if you have a bug on your server but you spend all your time trying to debug the client because you have a log "proving" that's where the problem is.

Invalidated sessions being reused

I opened this issue on firebase-ios-sdk as well:

Environment

  • Xcode version: 9.3
  • Firebase SDK version: 4.0.11
  • Firebase Component: Auth
  • Component version: 4.3.2

Problem

Auth / GTMSessionFetcher are re-using invalidated NSURLSessions:

Fatal Exception: NSGenericException
0  CoreFoundation                 0x184596d8c __exceptionPreprocess
1  libobjc.A.dylib                0x1837505ec objc_exception_throw
2  CFNetwork                      0x184b25bfc __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke
3  App                     	  0x1046a96c0 -[GTMSessionFetcher beginFetchMayDelay:mayAuthorize:] (GTMSessionFetcher.m:761)
4  App                     	  0x1045f5cc4 -[FIRAuthBackendRPCIssuerImplementation asyncPostToURLWithRequestConfiguration:URL:body:contentType:completionHandler:] (FIRAuthBackend.m:527)
5  App                     	  0x1045f77c4 -[FIRAuthBackendRPCImplementation postWithRequest:response:callback:] (FIRAuthBackend.m:779)
6  App                            0x1045f6990 -[FIRAuthBackendRPCImplementation secureToken:callback:] (FIRAuthBackend.m:629)
7  App                            0x1045f5484 +[FIRAuthBackend secureToken:callback:] (FIRAuthBackend.m:435)
8  App                            0x104605f68 -[FIRSecureTokenService requestAccessToken:] (FIRSecureTokenService.m:199)
9  App                            0x104605a44 __65-[FIRSecureTokenService fetchAccessTokenForcingRefresh:callback:]_block_invoke (FIRSecureTokenService.m:118)
10 App                            0x1045fca00 __38-[FIRAuthSerialTaskQueue enqueueTask:]_block_invoke (FIRAuthSerialTaskQueue.m:49)
11 libdispatch.dylib              0x183e88b24 _dispatch_call_block_and_release
12 libdispatch.dylib              0x183e88ae4 _dispatch_client_callout
13 libdispatch.dylib              0x183ec71b4 _dispatch_queue_serial_drain$VARIANT$armv81
14 libdispatch.dylib              0x183ec7ad8 _dispatch_queue_invoke$VARIANT$armv81
15 libdispatch.dylib              0x183ec7074 _dispatch_queue_serial_drain$VARIANT$armv81
16 libdispatch.dylib              0x183ec7ad8 _dispatch_queue_invoke$VARIANT$armv81
17 libdispatch.dylib              0x183ec847c _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81
18 libdispatch.dylib              0x183ed044c _dispatch_workloop_worker_thread$VARIANT$armv81
19 libsystem_pthread.dylib        0x1841bbe70 _pthread_wqthread
20 libsystem_pthread.dylib        0x1841bbb08 start_wqthread

Delegate Callback Queue not configured for restored background upload sessions

If you create an upload fetcher with the useBackgroundSession property set to YES and then resume the app while the upload is still in progress, the reconstructed fetcher does not send messages to its configured sendProgressBlock.

It looks the like the issue is that the reconstruction process doesn't configure the _delegateCallbackQueue property of the fetcher (whereas creating a new fetcher configures it to self.callbackQueue in -[GTMSessionFetcher beginFetchWithCompletionHandler:]).

I'm not sure if this is a bug or an issue that I'm not fully understanding. Configuring the delegate queue in +[GTMSessionUploadFetcher uploadFetchersForBackgroundSessions] starts propagating the calls to sendProgressBlock - around https://github.com/google/gtm-session-fetcher/blob/master/Source/GTMSessionUploadFetcher.m#L301, add

[uploadFetcher setDelegateCallbackQueue: uploadFetcher.callbackQueue];

XCode 9.3 warnings for GTMSessionFetcher 1.1.14

I'm seeing the following warnings when I build my project:

/Users/tedhopp/Public/Projects/My Tikkun/Pods/GTMSessionFetcher/Source/GTMMIMEDocument.m:396:47: Format specifies type 'ssize_t' (aka 'long') but the argument has type 'int'
/Users/tedhopp/Public/Projects/My Tikkun/Pods/GTMSessionFetcher/Source/GTMMIMEDocument.m:396:64: Values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead
/Users/tedhopp/Public/Projects/My Tikkun/Pods/GTMSessionFetcher/Source/GTMMIMEDocument.m:434:66: Format specifies type 'ssize_t' (aka 'long') but the argument has type 'int'
/Users/tedhopp/Public/Projects/My Tikkun/Pods/GTMSessionFetcher/Source/GTMSessionFetcher.m:434:48: Values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead
/Users/tedhopp/Public/Projects/My Tikkun/Pods/GTMSessionFetcher/Source/GTMSessionFetcher.h:301:69: Expanded from macro 'GTMSESSION_ASSERT_DEBUG'
/Users/tedhopp/Public/Projects/My Tikkun/Pods/GTMSessionFetcher/Source/GTMSessionFetcher.m:2663:28: Values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead
/Users/tedhopp/Public/Projects/My Tikkun/Pods/GTMSessionFetcher/Source/GTMSessionFetcher.h:284:45: Expanded from macro 'GTMSESSION_LOG_DEBUG'

I'm using XCode 9.3 and GTMSessionFetcher version 1.1.14.

Crash on CCTClearcutUploader

On of the users off our app had a crash on CCTClearcutUploader. This was reported via Firebase Analytics. Here is the information regarding the crash:

Stacktrace:

Gecrasht: CCTClearcutUploader
SIGABRT ABORT 0x0000000181b4d2ec
0
libsystem_kernel.dylib
__pthread_kill + 8
1
libsystem_pthread.dylib
pthread_kill$VARIANT$mp + 376
2
libsystem_c.dylib
abort + 140
3
libsystem_malloc.dylib
szone_size + 634
4
CoreFoundation
mdict_rehashd + 288
5
CoreFoundation
-[__NSDictionaryM setObject:forKeyedSubscript:] + 352
arrow_right 6
Crewlink
+[FPRFeatureControl featureForceState:] + 4299811352
7
Crewlink
+[FPRFeatureControl featureEnabled:] + 4299809144
8
Crewlink
__InstrumentSessionWithConfigurationDelegateDelegateQueue_block_invoke + 4299878268
9
GTMSessionFetcher
GTMSessionFetcher.m - Regel 622
-[GTMSessionFetcher beginFetchMayDelay:mayAuthorize:]
10
Crewlink
-[CCTClearcutUploader uploadNonBatch:] + 4299909992
11
Crewlink
-[CCTClearcutUploader uploadNext] + 4299909056
12
Crewlink
__66-[CCTClearcutUploader uploadWithCompletionHandler:isOnForeground:]_block_invoke + 4299904712
13
libdispatch.dylib
_dispatch_call_block_and_release + 24
14
libdispatch.dylib
_dispatch_client_callout + 16
15
libdispatch.dylib
_dispatch_queue_serial_drain$VARIANT$mp + 608
16
libdispatch.dylib
_dispatch_queue_invoke$VARIANT$mp + 336
17
libdispatch.dylib
_dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 340
18
libdispatch.dylib
_dispatch_workloop_worker_thread$VARIANT$mp + 668
19
libsystem_pthread.dylib
_pthread_wqthread + 860
20
libsystem_pthread.dylib
start_wqthread + 4
BKSAssertionClientMultiplexer
0
AssertionServices
-[BKSAssertion _clientQueue_acquireAssertion] + 10
9 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
com.apple.network.boringssl.metrics_queue
0
libsystem_kernel.dylib
mach_msg_trap + 8
16 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
Thread #1
0
libsystem_kernel.dylib
__workq_kernreturn + 8
2 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
com.apple.uikit.eventfetch-thread
0
libsystem_kernel.dylib
mach_msg_trap + 8
11 arrow_drop_down
libsystem_pthread.dylib
thread_start + 4
Thread #2
0
libsystem_pthread.dylib
start_wqthread + 122
com.twitter.crashlytics.ios.binary-images
0
libsystem_kernel.dylib
write + 8
1
Crewlink
CLSFile.m - Regel 244
__CLSFileWriteWithRetries_block_invoke
2
Crewlink
CLSFile.m - Regel 213
CLSFileLoopWithWriteBlock
3
Crewlink
CLSFile.m - Regel 190
CLSFileWriteToFileDescriptorOrBuffer
4
Crewlink
CLSFile.m - Regel 488
CLSFileWriteHashKey
5
Crewlink
CLSFile.m - Regel 512
CLSFileWriteHashEntryString
6
Crewlink
CLSBinaryImage.m - Regel 440
CLSBinaryImageRecordDetails
7
Crewlink
CLSBinaryImage.m - Regel 514
__CLSBinaryImageChanged_block_invoke
8
libdispatch.dylib
_dispatch_call_block_and_release + 24
15 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
FIRAnalyticsQueue
0
libsystem_kernel.dylib
__ulock_wake + 8
1 arrow_drop_down
libdispatch.dylib
_dispatch_unfair_lock_wake + 36
2
Crewlink
+[FIRAMeasurement monitor] + 4299362772
3
Crewlink
__55+[FIRAMeasurement initializeSharedInstanceWithOptions:]_block_invoke + 4299362428
4
libdispatch.dylib
_dispatch_client_callout + 16
5 arrow_drop_down
libdispatch.dylib
dispatch_once_f$VARIANT$mp + 60
6
Crewlink
+[FIRAMeasurement initializeSharedInstanceWithOptions:] + 4299362324
7
Crewlink
__47+[FIRAnalytics startWithConfiguration:options:]_block_invoke_2 + 4299466020
8
libdispatch.dylib
_dispatch_call_block_and_release + 24
15 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
Thread #3
0
libsystem_pthread.dylib
start_wqthread + 122
com.twitter.crashlytics.ios.MachExceptionServer
0
libsystem_kernel.dylib
mach_msg_trap + 8
1 arrow_drop_down
libsystem_kernel.dylib
mach_msg + 72
2
Crewlink
CLSMachException.c - Regel 180
CLSMachExceptionServer
3
libsystem_pthread.dylib
_pthread_body + 272
5 arrow_drop_down
libsystem_pthread.dylib
thread_start + 4
CCTClearcutUploader
0
libsystem_kernel.dylib
__open + 8
4 arrow_drop_down
Foundation
+[NSData(NSData) dataWithContentsOfURL:options:error:] + 68
5
Crewlink
-[CCTClearcutUploader logFiles] + 4299906700
6
Crewlink
__66-[CCTClearcutUploader uploadWithCompletionHandler:isOnForeground:]_block_invoke + 4299904272
7
libdispatch.dylib
_dispatch_call_block_and_release + 24
14 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
Thread #4
0
libsystem_kernel.dylib
__workq_kernreturn + 8
2 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
Thread #5
0
libsystem_pthread.dylib
start_wqthread + 122
com.apple.main-thread
0
libsystem_kernel.dylib
__open + 8
23 arrow_drop_down
UIKit
UIApplicationMain + 236
24
Crewlink
CrewlinkViewController.swift - Regel 16
main
25
libdyld.dylib
start + 4
Thread #6
0
libsystem_kernel.dylib
__workq_kernreturn + 8
2 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
phenotype.completionQueue
0
CoreFoundation
__CFSearchStringROM + 124
7 arrow_drop_down
CFNetwork
+[NSURLSession sessionWithConfiguration:delegate:delegateQueue:] + 508
8
Crewlink
__InstrumentSessionWithConfigurationDelegateDelegateQueue_block_invoke + 4299878464
9
GTMSessionFetcher
GTMSessionFetcher.m - Regel 622
-[GTMSessionFetcher beginFetchMayDelay:mayAuthorize:]
10
Crewlink
-[PHTSyncOperation sendRequest:changeCount:] + 4300013944
11
Crewlink
__27-[PHTSyncOperation execute]_block_invoke + 4300013148
12
Crewlink
__63-[PHTPhenotypeDatabase performTransactionInsideQueue:onFinish:]_block_invoke.246 + 4300068572
13
libdispatch.dylib
_dispatch_call_block_and_release + 24
20 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
com.apple.network.connections
0
libboringssl.dylib
do_seal_record + 340
20 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
PHTPhenotypeSyncQueue
0
libsystem_kernel.dylib
semaphore_wait_trap + 8
2 arrow_drop_down
libdispatch.dylib
_dispatch_semaphore_wait_slow + 136
3
Crewlink
__50-[PHTPhenotype syncAllAccounts:syncType:callback:]_block_invoke + 4299957872
4
libdispatch.dylib
_dispatch_call_block_and_release + 24
11 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
Thread #7
0
libsystem_kernel.dylib
__workq_kernreturn + 8
2 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
com.apple.NSURLSession-work
0
libobjc.A.dylib
search_method_list(method_list_t const*, objc_selector*) + 80
18 arrow_drop_down
libsystem_pthread.dylib
start_wqthread + 4
com.apple.NSURLConnectionLoader
0
libsystem_kernel.dylib
mach_msg_trap + 8
9 arrow_drop_down
libsystem_pthread.dylib
thread_start + 4

KEYS:
crash_info_entry_0 -> abort() called
crash_info_entry_1 -> *** error for object 0x101c731b0: pointer being freed was not allocated

DEVICE INFO
Model: iPhone 6
Stand: Front up
Available RAM: 110.7 MB
diskspace: 35.91 GB

Versie: 11.3.0 (15E216)
Stand: Portrait
Jailbroken: No
Date: 19 apr. 2018 19:17:00

Redirect test seems to be failing. Flakey?

https://travis-ci.org/google/gtm-session-fetcher/jobs/100160154

  -[GTMSessionFetcherFetchingTest testRedirectFetch]

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
/Users/travis/build/google/gtm-session-fetcher/Source/UnitTests/GTMSessionFetcherFetchingTest.m:852: (([fetcher waitForCompletionWithTimeout:_timeoutInterval]) is true) failed - timed out:
NSHTTPCookie *firstCookie = [cookies firstObject];
XCTAssertEqualObjects([firstCookie value], @"gettysburgaddress.txt");
}];
XCTAssertTrue([fetcher waitForCompletionWithTimeout:_timeoutInterval], @"timed out");

testRetryFetches then runs next and never completes before travis tends to kill the tests.

Invalid cast in GTMSessionFetcherService

Hello

This issue was described in several tickets but solution is still not there.

There are several third-party libraries that swizzle URLSession's delegate with their own proxy objects. For example TrustKit and SplunkMint do that. However GTMSessionFetcherService completely ignores this fact and hard-casts these proxy objects to its own class - GTMSessionFetcherSessionDelegateDispatcher:

return (GTMSessionFetcherSessionDelegateDispatcher *)fetcherDelegate;

    BOOL hasDispatcher = (fetcherDelegate != nil &&
                          ![fetcherDelegate isKindOfClass:[GTMSessionFetcher class]]);
    if (hasDispatcher) {
      GTMSESSION_ASSERT_DEBUG([fetcherDelegate isKindOfClass:[GTMSessionFetcherSessionDelegateDispatcher class]],
                              @"Fetcher delegate class: %@", [fetcherDelegate class]);
      return (GTMSessionFetcherSessionDelegateDispatcher *)fetcherDelegate;
    }

Obviously later we get crashes in different places due to "unrecognized selector sent to instance" exceptions.

The "dumb" solution is to check the class of object before casting it:

      if ([fetcherDelegate isKindOfClass:[GTMSessionFetcherSessionDelegateDispatcher class]]) {
        return (GTMSessionFetcherSessionDelegateDispatcher *)fetcherDelegate;
      }
      else {
        return nil;
      }

But having almost zero knowledge of how GTMSessionFetcher works, it's hard for me to understand if this code breaks something else. Any advice from the team?

We consume this library indirectly via FirebaseAuth.

Thanks,
Vlad

Using Package Manager Resources in Swift PM Unit Tests

Currently, in order to have successful tests when using the Swift Package Manager the gettysburgaddress.txt file is copied manually to the unit test bundle resources folder.

#if SWIFT_PACKAGE
// Swift Pacage Manager does not support resources distribution currently,
// therefore the "gettysburgaddress.txt" file must be copied manually to the test bundle.
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSString *gettysburg = @""\
"Four score and seven years ago our fathers brought forth on this continent, a"\
"new nation, conceived in liberty, and dedicated to the proposition that all men"\
"are created equal.";
NSString * resourcePath = [testBundle resourcePath];
XCTAssertNotNil(resourcePath);
if (![[NSFileManager defaultManager] fileExistsAtPath:resourcePath]) {
NSError *createDirectoryError = nil;
if (![[NSFileManager defaultManager] createDirectoryAtPath:resourcePath
withIntermediateDirectories:true
attributes:nil
error:&createDirectoryError]) {
XCTFail("Failed to create the Resources directory, error: %@", createDirectoryError);
}
}
NSString *gettysburgPath = [resourcePath stringByAppendingPathComponent:@"gettysburgaddress.txt"];
NSError *writeError = nil;
if (![gettysburg writeToFile:gettysburgPath
atomically:true
encoding:NSUTF8StringEncoding
error:&writeError]) {
XCTFail("Failed to write `gettysburgaddress.txt` bundle Resource, error: %@", writeError);
}
});
#endif

Swift 5.3 introduced a new feature called Package Manager Resources. Once this gets rolled into production, it must be used to copy resources rather than doing it manually.

Insecure Storage: Lacking Data Protection

On line 812 of GTMSessionFetcherLogging.m, the method logFetchWithError:() writes data to a file lacking sufficient encryption settings.The identified method writes data to a file lacking sufficient encryption settings.

build error

google-api-objectivec-client-read-only/Source/HTTPFetcher/GTMHTTPFetcher.m:458:44: 'initWithRequest:delegate:startImmediately:' is deprecated: first deprecated in OS X 10.11 - Use NSURLSession (see NSURLSession.h)

connection_ = [[connectionClass alloc] initWithRequest:request_
delegate:self
startImmediately:NO];

i get an error, but i dont fix it? please help me

Data race between `GPBMessage` and `GPBDescriptor`

Hi,

I'm using some Firebase tools, and was debugging with the thread sanitizer enabled when I received a warning about a data race on some internal library objects. Here is the TSAN output that appeared in my Xcode console:

==================
WARNING: ThreadSanitizer: race on NSMutableArray (pid=70981)
  Read-only access of NSMutableArray at 0x7b0c0019b240 by thread T21:
    #0 -[__NSArrayM countByEnumeratingWithState:objects:count:] <null>:1061136 (CoreFoundation:x86_64+0x72df8)
    #1 +[GPBMessage resolveInstanceMethod:] <null>:1061136 (Target:x86_64+0x101e05b2f)
    #2 _dispatch_client_callout <null>:1061136 (libdispatch.dylib:x86_64+0x37eb)

  Previous modifying access of NSMutableArray at 0x7b0c0019b240 by thread T15:
    #0 -[__NSArrayM addObject:] <null>:1061136 (CoreFoundation:x86_64+0x27d88)
    #1 +[GPBDescriptor allocDescriptorForClass:rootClass:file:fields:fieldCount:storageSize:flags:] <null>:1061136 (Target:x86_64+0x101dd2bd4)
    #2 _dispatch_client_callout <null>:1061136 (libdispatch.dylib:x86_64+0x37eb)

  Location is heap block of size 40 at 0x7b0c0019b240 allocated by thread T15:
    #0 calloc <null>:1061152 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x471a2)
    #1 class_createInstance <null>:1061152 (libobjc.A.dylib:x86_64+0xf37f)
    #2 _dispatch_client_callout <null>:1061152 (libdispatch.dylib:x86_64+0x37eb)

  Thread T21 (tid=8959546, running) is a GCD worker thread

  Thread T15 (tid=8956171, running) is a GCD worker thread

SUMMARY: ThreadSanitizer: race on NSMutableArray (CoreFoundation:x86_64+0x72df8) in -[__NSArrayM countByEnumeratingWithState:objects:count:]
==================

And here is further info after the application was suspended by the debugger:

(lldb) thread info -s
thread #38: tid = 0x88b63a, 0x00000001129976a0 libclang_rt.tsan_iossim_dynamic.dylib`__tsan_on_report, queue = 'CCTClearcutUploader', stop reason = Race on a library object detected

{
  "all_addresses_are_same" : true,
  "description" : "Race on a library object",
  "instrumentation_class" : "ThreadSanitizer",
  "issue_type" : "external-race",
  "location_description" : "Location is a 40-byte heap object at 0x7b0c0019b240",
  "locs" : [
    {
      "address" : 0,
      "file_descriptor" : 0,
      "index" : 0,
      "object_type" : "",
      "size" : 40,
      "start" : 135291471508032,
      "suppressable" : 0,
      "thread_id" : 16,
      "trace" : [
        4606939555,
        4713079680,
        4854634476
      ],
      "type" : "heap"
    }
  ],
  "memory_address" : 135291471508032,
  "mops" : [
    {
      "address" : 135291471508032,
      "index" : 0,
      "is_atomic" : false,
      "is_write" : false,
      "size" : 1,
      "thread_id" : 38,
      "trace" : [
        4737015289,
        4568242992,
        4854634476
      ]
    },
    {
      "address" : 135291471508032,
      "index" : 1,
      "is_atomic" : false,
      "is_write" : true,
      "size" : 1,
      "thread_id" : 16,
      "trace" : [
        4736707977,
        4568034261,
        4854634476
      ]
    }
  ],
  "mutexes" : [

  ],
  "report_count" : 0,
  "sleep_trace" : [

  ],
  "stacks" : [

  ],
  "stop_description" : "Race on a library object detected",
  "summary" : "Race on a library object in +[GPBMessage resolveInstanceMethod:] at 0x7b0c0019b240",
  "threads" : [
    {
      "index" : 0,
      "name" : "",
      "parent_thread_id" : 0,
      "running" : 1,
      "thread_id" : 38,
      "thread_os_id" : 8959546,
      "trace" : [
        4606805902,
        4761944576,
        4854634476
      ]
    },
    {
      "index" : 1,
      "name" : "",
      "parent_thread_id" : 0,
      "running" : 1,
      "thread_id" : 16,
      "thread_os_id" : 8956171,
      "trace" : [

      ]
    }
  ],
  "unique_tids" : [

  ]
}

I thought this might be the same as #117, because the CCTClearcutUploader queue is involved, but I think the issue is actually different.

Naively it looks like there is some shared dictionary cache in the GPB (protobuf?) library that doesn't synchronize access, but can be manipulated concurrently from multiple threads.

GTMSessionFetcher seems to be accumulating data, even though a a download path is specified

We are using the GTMSessionFetcher (1.1.6) in order to download files from Google Drive. We are having memory issues with large files.

Previously we were using GTMFetcher, but we updated our libraries. In using the session fetcher, we are specifying a DownloadProgressBlock, DestinationFileURL and completion handler, like the following:

fetcher = [weakSelf.driveService.fetcherService fetcherWithURLString:url];

[fetcher setDownloadProgressBlock:downloadProgressHandler];
NSURL *myURL = [NSURL fileURLWithPath:fullpath];
[fetcher setDestinationFileURL:myURL];
[fetcher beginFetchWithCompletionHandler:completionHandler];

Everything downloads okay, but the memory increases and, for large files, runs out of memory.

Previously, we had the following, which did not have the memory problem:
fetcher = [weakSelf.driveService.fetcherService fetcherWithURLString:url];

[fetcher setReceivedDataBlock:receivedData]; // setReceivedDataBlock is no longer available in the updated library
[fetcher setDownloadPath:fullpath]; // setDownloadPath is no longer available in the updated library
[fetcher beginFetchWithCompletionHandler:completionHandler];

Is there some additional configuration needed, so that data is not accumulated? I tried [fetcher setAccumlatedDataBlock:nil], but that seemed to have no effect.

Thank you!
-Kevin

UnitTest Flake / Timing issues

Running the tests with Xcode 8.3 almost always passes, but under automation (travis or otherwise), we see a lot of flakes. If the automation uses VMs (travis), it seems like they are even more common. So odds are we've got timing issues within the tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.