Giter VIP home page Giter VIP logo

amplitude-ios's People

Contributors

allanca avatar allcontributors[bot] avatar amplitude-sdk-bot avatar bgiori avatar blazzy avatar bohan-amplitude avatar crleona avatar curtisliu avatar daltonclaybrook avatar dependabot[bot] avatar djih avatar falconandy avatar haoliu-amp avatar izaaz avatar jannash avatar jooohhn avatar justin-fiedler avatar kmunechika avatar lapfelix avatar lexrus avatar liuyang1520 avatar mercy811 avatar michaelpetrov avatar piechart avatar qingzhuozhen avatar readmecritic avatar sodastsai avatar sputh avatar sskates avatar yuhao900914 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  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

amplitude-ios's Issues

NSString *deviceId not initialized properly in _getDeviceId

Hi,

If a given binary has the "correct" layout in the final build, it is possible that Amplitude crashes the application (confirmed in iOS5.1.1 on an iPad1 at least).

In Amplitude.m on line 835:
NSString *deviceId;
needs to be:
NSString *deviceId = nil;

Otherwise the deviceId can end up pointing to arbitrary garbage that may pass the subsequent conditionals and thus never properly initializing the deviceId with a meaningful string.

Let me know if you need more information.

Thanks!
-cojo

Change Amplitude ID

Hi,
i got 2 amplitude app setup that i use for the same app but on different environments (ie: production and staging).
Is it possible to call initializeApiKey: a second time when the environment gets switched or i have to restart the app to let the events go through the proper app and the user id reset?
Thank you

User properties doesn't clear anymore

A recent update broke the setUserProperties replace method, where the replace parameter is ignored.
540a8e2#diff-2777663457a583bbf669698eaadec79bR1016

On top of that, the README.md still describes using replace:

To replace any existing user properties with a new set:
NSMutableDictionary *userProperties = [NSMutableDictionary dictionary];
[userProperties setValue:@"VALUE_GOES_HERE" forKey:@"KEY_GOES_HERE"];
[[Amplitude instance] setUserProperties:userProperties replace:YES];

Previously, the following would clear user properties:

[[Amplitude instance] setUserProperties:@{} replace:YES];

The most onerous problem that happened is that the contract of a public SDK changed without warning or notice. It break contracts of public SDKs. The function was left in a public SDK so that it compiles, but quietly ignores the parameter with no warning whatsoever.

Regardless of the broken contract, AFAICT the new API doesn't have the ability to to "clear all" properties. It appears you have to know which properties existed before, which may not be possible.

GGEventLog.m missing UIKit import

We shouldn't assume that UIKit is imported by the PCH, as this won't always be the case.

--- a/GGEventLog.m
+++ b/GGEventLog.m
@@ -16,6 +16,7 @@
 #import <net/if.h>
 #import <net/if_dl.h>
 #import <CommonCrypto/CommonDigest.h>
+#import <UIKit/UIKit.h>

 static NSString *_apiKey;
 static NSString *_userId;

Clang static analyzer complains about memory leak

line 885 in Amplitude.m, + (NSString*)generateRandomId, it looks like if __has_feature(objc_arc) is false your call to CFUUIDCreateString does not have a balancing call to I'm guessing CFRelease((CFStringRef)uuidStr) (which would probably need another __has_feature check).

Allow user properties to be completely cleared

There are many reasons that a full clear of the user properties is useful. Sometimes the user properties come from different sources (such as a server) where the keys are dynamically determined. Something like [[Amplitude instance] clearUserProperties].

This would be useful in both the Android and iOS clients.

upgradePrefs call guaranteed nil destination

Having some issues with old users' migrating to the newer version of amplitude.

Inside of the initWithInstanceName: there is a call to upgradePrefs which is dependent on the _propertyListPath and _eventsDataPath being set. Otherwise the copyItemAtPath:toPath:error: with crash with a nil destination exception. However, the _eventsDataPath isn't set until after the upgradePrefs call is done and released immediately.

Not sure what the best solution would be. Perhaps splitting up the upgradePrefs call to two separate calls to reflect the different dependencies?

Thanks for your help!

Swift 2.0, XCode 7.1 Setting nil to Amplitude.instance().setUserId crashes

Using Cocoapods 3.1.1

This happens extremely randomly...

Commenting out the API intialization fixes everything

2015-10-18 18:10:31.352 Eden[9145:776613] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSPlaceholderString initWithString:]: nil argument'
*** First throw call stack:
(0x1860f82d8 0x197dcc0e4 0x1860f8218 0x186f2c824 0x10046c1b0 0x1005b3794 0x102334f94 0x10233f08c 0x1005b36c0 0x10046be30 0x10046bc20 0x100471bac 0x186fdf1c4 0x186f30604 0x186f201cc 0x186fe1f28 0x102334f94 0x10233fdb8 0x1023382c4 0x1023425d4 0x102344248 0x19862922c 0x198628ef0)
libc++abi.dylib: terminating with uncaught exception of type NSException

App Extension -Issue

Hi ,
@djih
As you said i have updated to 3.8.0 i am able to use the sdk for both app and app extension.
but the events from app extension not reflecting in dashboard.Kindly help me

AMPRevenue. Price for other currencies?

Hi there!

For now if you want to track revenue you can only use "USD" currency. Is it possible to track revenue in other currencies (e.g. CHF, RUB)? SKProduct contains price only in local currency.

Broken isfinite causes NaN values to pass makeJSONSerializable

 0   CoreFoundation                      0x0000000114c3ee65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000114225deb objc_exception_throw + 48
    2   CoreFoundation                      0x0000000114c3ed9d +[NSException raise:format:] + 205
    3   Foundation                          0x000000011115f857 _writeJSONNumber + 707
    4   Foundation                          0x000000011115c81b _writeJSONValue + 486
    5   Foundation                          0x000000011116054a ___writeJSONObject_block_invoke + 226
    6   CoreFoundation                      0x0000000114bab6d5 __65-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 85
    7   CoreFoundation                      0x0000000114bab5dd -[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:] + 237
    8   Foundation                          0x000000011115fcd4 _writeJSONObject + 436
    9   Foundation                          0x000000011115c7c1 _writeJSONValue + 396
    10  Foundation                          0x000000011116054a ___writeJSONObject_block_invoke + 226
    11  CoreFoundation                      0x0000000114b76df6 __65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102
    12  CoreFoundation                      0x0000000114b76cea -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 202
    13  Foundation                          0x000000011115fcd4 _writeJSONObject + 436
    14  Foundation                          0x000000011115c7c1 _writeJSONValue + 396
    15  Foundation                          0x000000011115c5e1 -[_NSJSONWriter dataWithRootObject:options:error:] + 124
    16  Foundation                          0x000000011115f002 +[NSJSONSerialization dataWithJSONObject:options:error:] + 333
    17  MyApp                            0x000000010f7d1027 __106-[Amplitude logEvent:withEventProperties:withApiProperties:withUserProperties:withTimestamp:outOfSession:]_block_invoke + 1175

This may be Apple's bug, but on iOS 9.1, isfinite(NaN) returns true, which leaves NaN's in the tree, which causes a crash when it's time to serialize.

https://github.com/amplitude/Amplitude-iOS/blob/81de6c4072a1e4a90203c6ff4e5176fd3c911743/Amplitude/AMPUtils.m#46

Add a class prefix to DeviceInfo

The fairly generic name DeviceInfo has high possibility to clash with other similarly named classes (and it does with a class in our codebase, preventing us to update to 2.2.0, unless we prefix our own internal class).

A standard practice in the Objective-C community when distributing SDKs is to prefix all of the class names to make such collisions less likely. I would recommend renaming DeviceInfo to something like AMDeviceInfo, ATDeviceInfo or AmplitudeDeviceInfo.

Strange crash

Hey.

I've seen a couple crashes in swift code:

let device = ApiDeviceInfo(timezone: timezone,
                           token: token,
                           amplitudeDeviceId: Amplitude.instance().deviceId)

Where timezone and token are String, i.e. are not optional values, and ApiDeviceInfo is simple struct.

struct ApiDeviceInfo {
  let timezone: String
  let token: String
  let amplitudeDeviceId: String
}

So, the only thing that can crash here is Amplitude.instance().deviceId, moreover crashlogs point to exact line amplitudeDeviceId: Amplitude.instance().deviceId).

The above code is executed in applicationDidBecomeActive. We do Amplitude.instance().initializeApiKey(apiKey) in AppDelegate's didFinishLaunchingWithOptions.

Crash can happen if Amplitude.instance() or Amplitude.instance().deviceId return nil. I'm wondering in which situations this can happen. Can't find this in the docs and there are no Obj-C nullability annotation in Amplitude sdk code. Which means that from Swift almost everything is accessible as implicitly unwrapped optionals, which is unsafe (Nullability and Optionals)

Do you have any ideas?

iOS 9 Deprecations

In the Amplitude.m file, there are two methods in use that have been deprecated since iOS 9. The first is CFURLCreateStringByAddingPercentEscapes and the second is sendAsynchronousRequest:queue:completionHandler:. I just wanted to bring these to your attention, and hopefully get some updates to remove the use of these deprecated methods.

Use short-circuiting for setUserId validation

When AMPLITUDE_DEBUG is set the current -setUserId validation incorrectly logs an error when nil is sent as the userId:

if (!([self isArgument:userId validType:[NSString class] methodName:@"setUserId:"] || userId == nil)) {
    return;
}

Would recommend testing for nil first to avoid the erroneous log given that nil is now a valid value:

BOOL validUserId = userId == nil || [self isArgument:userId validType:[NSString class] methodName:@"setUserId:"];
if (!validUserId) {
    return;
}

Carthage support

Hi,
could you please add support for Carthage? You just need to add shared framework scheme

CTTelephonyNetworkInfo should not be released

I experienced a crash similar to this one in the TestFlight SDK http://stackoverflow.com/questions/14238586/coretelephony-crash

The TestFlight SDK had an issue with CoreTelephony. They resolved it by keeping a reference to CTTelephonyNetworkInfo throughout the life of the application. (static variable or property of a class instance that you keep around forever).

I think Amplitude should keep a reference to CTTelephonyNetworkInfo and not release it.

Also see TestFlight 2.0 change notes: https://github.com/spenrose/TestFlight-SDK/blob/master/release_notes.md

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x000000019533bbd0 objc_msgSend + 16
1  CoreTelephony                  0x000000018557ca58 _ServerConnectionCallback(__CTServerConnection*, __CFString const*, __CFDictionary const*, void*) + 52
2  CoreTelephony                  0x0000000185591030 ___ZNK13CTServerState21sendNotification_syncE7CTEventPK10__CFStringPK14__CFDictionary_block_invoke14 + 32
3  CoreFoundation                 0x0000000184ba1fd4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
4  CoreFoundation                 0x0000000184ba1c84 __CFRunLoopDoTimer + 888
5  CoreFoundation                 0x0000000184b9f6d0 __CFRunLoopRun + 1372
6  CoreFoundation                 0x0000000184acd1f4 CFRunLoopRunSpecific + 396
7  GraphicsServices               0x000000018dc5b5a4 GSEventRunModal + 168
8  UIKit                          0x00000001893fe784 UIApplicationMain + 1488
9  Status                         0x0000000100081780 main (main.m:16)
10 libdyld.dylib                  0x0000000195996a08 start + 4

Getting crashes on iOS 10

__51-[AMPDatabaseHelper inDatabaseWithStatement:block:]_block_invoke

#0
Crashed: com.amplitude.db.queue
SIGABRT ABORT 0x000000018fffa014

Crashed: com.amplitude.db.queue
0  libsystem_kernel.dylib         0x18fffa014 __pthread_kill + 8
1  libsystem_pthread.dylib        0x1900c1460 pthread_kill + 112
2  libsystem_c.dylib              0x18ff6e3f4 abort + 140
3  libsystem_malloc.dylib         0x19003ea38 _nano_vet_and_size_of_live + 330
4  libsystem_malloc.dylib         0x19003fdb8 nano_free + 220
5  libsqlite3.dylib               0x19159f6f8 (null) + 2552
6  libsqlite3.dylib               0x1915a5924 (null) + 1204
7  Amplitude_iOS                  0x10161cbf0 __51-[AMPDatabaseHelper inDatabaseWithStatement:block:]_block_invoke + 224
8  libdispatch.dylib              0x18feb51c0 _dispatch_client_callout + 16
9  libdispatch.dylib              0x18fec2860 _dispatch_barrier_sync_f_invoke + 84
10 Amplitude_iOS                  0x10161caa0 -[AMPDatabaseHelper inDatabaseWithStatement:block:] + 228
11 Amplitude_iOS                  0x10161e774 -[AMPDatabaseHelper getValueFromTable:key:] + 276
12 Amplitude_iOS                  0x1016269e8 -[Amplitude optOut] + 60
13 Amplitude_iOS                  0x101622cd4 __117-[Amplitude logEvent:withEventProperties:withApiProperties:withUserProperties:withGroups:withTimestamp:outOfSession:]_block_invoke + 52
14 Foundation                     0x191aed7e4 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
15 Foundation                     0x191a32358 -[NSBlockOperation main] + 96
16 Foundation                     0x191a22954 -[__NSOperationInternal _start:] + 620
17 Foundation                     0x191aefb90 __NSOQSchedule_f + 228
18 libdispatch.dylib              0x18feb51c0 _dispatch_client_callout + 16
19 libdispatch.dylib              0x18fec3444 _dispatch_queue_serial_drain + 928
20 libdispatch.dylib              0x18feb89a8 _dispatch_queue_invoke + 652
21 libdispatch.dylib              0x18fec538c _dispatch_root_queue_drain + 572
22 libdispatch.dylib              0x18fec50ec _dispatch_worker_thread3 + 124
23 libsystem_pthread.dylib        0x1900bd2c8 _pthread_wqthread + 1288
24 libsystem_pthread.dylib        0x1900bcdb4 start_wqthread + 4

[NSFileManager copyItemAtPath:toPath:options:error:]: destination path is nil

Hello,

Im using Segment-Amplitude SDK to send data to Amplitude but there is some session tracking issue that requires to include Amplitude-iOS SDK too. We include the library and everything was working fine with our beta testers, but when my app went into production, some users started to experience crashes.

I'm writing you guys because i couldn't figure out what is causing this error. it happens with some users at the moment. my app users have the same features so i would think it should be affecting everyone of them, but it s not. There wasn't errors until i include Amplitude-iOS SDK. Hopefully you can point me in right direction and solve this issue.

these are the pods versions i'm using at the moment

Segment-Amplitude (1.2.0):
- Amplitude-iOS (> 3.6.0)
- Analytics (
> 3.0.7)

This is my basic implementation in AppDelegate

let segmentConfig : SEGAnalyticsConfiguration = SEGAnalyticsConfiguration(writeKey: SegmentWriteKey)
let segmentAmplitude : SEGAmplitudeIntegrationFactory = SEGAmplitudeIntegrationFactory.instance()
segmentConfig.use(segmentAmplitude)
SEGAnalytics.setupWithConfiguration(segmentConfig)

This is the error log from crashlytics:

Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x19085afd8 __exceptionPreprocess
1 libobjc.A.dylib 0x18f2bc538 objc_exception_throw
2 CoreFoundation 0x19085af20 -[NSException initWithCoder:]
3 Foundation 0x1912f8e04 -[NSFileManager copyItemAtPath:toPath:options:error:]
4 Degusta 0x1007d4314 -[Amplitude moveFileIfNotExists:to:] (Amplitude.m:1527)
5 Degusta 0x1007d3ce4 -[Amplitude upgradePrefs] (Amplitude.m:1435)
6 Degusta 0x1007ce1a4 __34-[Amplitude initWithInstanceName:]_block_invoke (Amplitude.m:250)
7 Foundation 0x191329804 NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK
8 Foundation 0x19126e760 -[NSBlockOperation main]
9 Foundation 0x19125eb18 -[__NSOperationInternal _start:]
10 Foundation 0x19132bba0 __NSOQSchedule_f
11 libdispatch.dylib 0x18f7129a0 _dispatch_client_callout
12 libdispatch.dylib 0x18f720ad4 _dispatch_queue_serial_drain

screen shot 2017-04-13 at 8 15 30 am

Latest version (2.2.2) AMPDeviceInfo crashes in Unity

Hi,

We tried to upgrade to the latest iOS SDK last night from pre-2.2.0, and the new DeviceInfo approach crashes randomly on event sends from our Unity game.

We've narrowed it down to what looks like retain issues with _model, _country, _language, _advertiserID, and _vendorID. appVersion, osVersion, and carrier all appear to be fine and don't get clobbered / cause EXC_BAD_ACCESS's like the aforementioned ones do.

For now we've added our own SAFE_ARC_RETAINs around the offending assignments, but to be honest it's not clear if this is the correct / best fix, so I wanted to flag it for you in case there's a better course of action.

Thanks!

Getting crashes

We are seeing some crashes on iOS9 (100% on 9.2.0)

Thread : Crashed: fmdb.<FMDatabaseQueue: 0x134d36f50>
0  libsystem_kernel.dylib         0x180aa0140 __pthread_kill + 8
1  libsystem_pthread.dylib        0x180b68ef8 pthread_kill + 112
2  libsystem_c.dylib              0x180a11dac abort + 140
3  libsystem_c.dylib              0x1809e6e7c basename + 322
4  Company                   0x10048a284 __30-[FMDatabaseQueue inDatabase:]_block_invoke (FMDatabaseQueue.m:147)
5  Company                   0x10044d480 -[AMPDatabaseHelper dropTables] (AMPDatabaseHelper.m:168)
6  Company                   0x10044d708 -[AMPDatabaseHelper resetDB:] (AMPDatabaseHelper.m:201)
7  Company                   0x10044e0d8 __53-[AMPDatabaseHelper getEventsFromTable:upToId:limit:]_block_invoke (AMPDatabaseHelper.m:287)
8  Company                   0x10048a2c0 __30-[FMDatabaseQueue inDatabase:]_block_invoke (FMDatabaseQueue.m:150)
9  libdispatch.dylib              0x1809515f0 _dispatch_client_callout + 16
10 libdispatch.dylib              0x18095c89c _dispatch_barrier_sync_f_invoke + 100
11 Company                   0x10048a230 -[FMDatabaseQueue inDatabase:] (FMDatabaseQueue.m:147)
12 Company                   0x10044dcdc -[AMPDatabaseHelper getEventsFromTable:upToId:limit:] (AMPDatabaseHelper.m:267)
13 Company                   0x100453d48 __35-[Amplitude uploadEventsWithLimit:]_block_invoke (Amplitude.m:713)
14 Company                   0x1004525a4 -[Amplitude runOnBackgroundQueue:] (Amplitude.m:443)
15 Company                   0x100453c48 -[Amplitude uploadEventsWithLimit:] (Amplitude.m:697)
16 Foundation                     0x1818a4334 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
17 Foundation                     0x1817f7100 -[NSBlockOperation main] + 96
18 Foundation                     0x1817e7348 -[__NSOperationInternal _start:] + 604
19 Foundation                     0x1818a6728 __NSOQSchedule_f + 224
20 libdispatch.dylib              0x1809515f0 _dispatch_client_callout + 16
21 libdispatch.dylib              0x18095d634 _dispatch_queue_drain + 864
22 libdispatch.dylib              0x1809550f4 _dispatch_queue_invoke + 464
23 libdispatch.dylib              0x18095f504 _dispatch_root_queue_drain + 728
24 libdispatch.dylib              0x18095f224 _dispatch_worker_thread3 + 112
25 libsystem_pthread.dylib        0x180b65470 _pthread_wqthread + 1092
26 libsystem_pthread.dylib        0x180b65020 start_wqthread + 4

Crash in 3.1.0

I was using Cocoapods version 3.0.0 and after upgrading to 3.1.0 I'm getting infinite loop and EXC_BAD_ACCESS in the end.
Take a look at attached screenshot for more details. It doesn't happen in Simulator but on real device. I've tested using iPhone 5C / iOS 9.0.2

screen shot 2015-10-06 at 17 22 02

Pod update/install fails - Could not find remote branch v3.1.0 to clone

[!] Error installing Amplitude-iOS
[!] /usr/bin/git clone https://github.com/amplitude/Amplitude-iOS.git /var/folders/sq/86hhftz177scgdzggq3zgf1h0000gn/T/d20151006-14311-4mjtwk --single-branch --depth 1 --branch v3.1.0

Cloning into '/var/folders/sq/86hhftz177scgdzggq3zgf1h0000gn/T/d20151006-14311-4mjtwk'...
warning: Could not find remote branch v3.1.0 to clone.
fatal: Remote branch v3.1.0 not found in upstream origin

pod --version
0.39.0.rc.1

Race condition in [Amplitude enterForeground]

Hello!

FYI, using the Thread Sanitizer in our codebase reveals a race condition in the enterForeground method:

==================
WARNING: ThreadSanitizer: data race (pid=76780)
  Read of size 8 at 0x7d34000099b0 by main thread:
    #0 -[Amplitude enterForeground] Amplitude.m:1071 (Amplitude_iOS:x86_64+0x23bf7)
    #1 -[Amplitude initializeApiKey:userId:setUserId:] Amplitude.m:483 (Amplitude_iOS:x86_64+0x17f82)
    #2 -[Amplitude initializeApiKey:] Amplitude.m:430 (Amplitude_iOS:x86_64+0x1785d)
    #3 +[Analytics testAmplitudeInstance] Analytics.m:167 (PlanGrid:x86_64+0x10056fe4b)
   ...
    #13 -[AppDelegate initialSetup] AppDelegate.m:115 (PlanGrid:x86_64+0x10001b622)
    #14 -[AppDelegate application:didFinishLaunchingWithOptions:] AppDelegate.m:67 (PlanGrid:x86_64+0x10001a91d)
    #15 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] <null>:1469812160 (UIKit:x86_64+0x1e956)
    #16 start <null>:1469812160 (libdyld.dylib:x86_64+0x465c)

  Previous write of size 8 at 0x7d34000099b0 by thread T8:
    #0 __34-[Amplitude initWithInstanceName:]_block_invoke Amplitude.m:251 (Amplitude_iOS:x86_64+0x14ab2)
    #1 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ <null>:1469812160 (Foundation:x86_64+0x42236)
    #2 _dispatch_client_callout <null>:1469812160 (libdispatch.dylib:x86_64+0x2b05b)

This is not affecting our usage, but figured it might be worth investigating as your time permits. Thanks for your work!

Rapid open and close causes crash from hanging background tasks

From Alexander Wong at EndersFund:
The crash logs look like this: <BKProcessAssertion: 0x176397a0> identifier: Called by Deadeye, from unknown method process: Deadeye[992] permittedBackgroundDuration: 180.000000 reason: finishTask owner pid:992 preventSuspend preventIdleSleep preventSuspendOnSleep

The SDK creates a background task to prevent the app from sleeping:

uploadTaskID = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
        //Took too long, manually stop
        [[UIApplication sharedApplication] endBackgroundTask:uploadTaskID];
        uploadTaskID = UIBackgroundTaskInvalid;
    }];

And also ends the background task at the end of

+ (void)makeEventUploadPostRequest:(NSString*) url events:(NSString*) events lastEventIDUploaded:(long long) lastEventIDUploaded.

I believe the issue is when the app is multi-tasked in rapid succession without makeEventUploadPostRequest finishing. That will cause the static variable uploadTaskID to be overriden and you can end up with multiple calls to beginBackgroundTask getting unmatched with the endBackgroundTask call.

Crash

Seeing crashes being reported caused by Amplitude

Thread : Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x0000000183e7c2d8 __exceptionPreprocess
1  libobjc.A.dylib                0x0000000195b480e4 objc_exception_throw
2  CoreFoundation                 0x0000000183e833a4 __methodDescriptionForSelector
3  CoreFoundation                 0x0000000183e80154 ___forwarding___
4  CoreFoundation                 0x0000000183d82ccc _CF_forwarding_prep_0
5  Foundation                     0x0000000184d684b4 _NSCreateTemporaryFile_Protected
6  Foundation                     0x0000000184d54128 +[NSKeyedArchiver archiveRootObject:toFile:]
7  Company                   0x0000000100448a54 -[Amplitude archive:toFile:] (Amplitude.m:1154)
8  Company                   0x00000001004484a8 -[Amplitude saveEventsData] (Amplitude.m:1070)
9  Company                   0x0000000100446724 __67-[Amplitude makeEventUploadPostRequest:events:lastEventIDUploaded:]_block_invoke (Amplitude.m:698)
10 CFNetwork                      0x000000018383b010 __67+[NSURLConnection sendAsynchronousRequest:queue:completionHandler:]_block_invoke_2
11 Foundation                     0x0000000184d631c4 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
12 Foundation                     0x0000000184cb4604 -[NSBlockOperation main]
13 Foundation                     0x0000000184ca41cc -[__NSOperationInternal _start:]
14 Foundation                     0x0000000184d65f28 __NSOQSchedule_f
15 libdispatch.dylib              0x00000001961c5954 _dispatch_client_callout
16 libdispatch.dylib              0x00000001961d00a4 _dispatch_queue_drain
17 libdispatch.dylib              0x00000001961c8a5c _dispatch_queue_invoke
18 libdispatch.dylib              0x00000001961d2318 _dispatch_root_queue_drain
19 libdispatch.dylib              0x00000001961d3c4c _dispatch_worker_thread3
20 libsystem_pthread.dylib        0x00000001963a522c _pthread_wqthread
21 libsystem_pthread.dylib        0x00000001963a4ef0 start_wqthread

[iOS] Log event on app crash

Hi,

I wonder if there is a way to log an event when my app crash for some reason (signal or unhandled exception). I check the web and the SDK code but didn't find a way.

Call any logEvent: method doesn't work because this methods work asynchronously and the app is terminated before the events are saved.

Thanks

Cocoapods issue with Amplitude

Getting errors on pod install, any thoughts?

[!] Unable to satisfy the following requirements:

- `Amplitude-iOS (= 3.0)` required by `Podfile`
- `Amplitude-iOS (= 3.0)` required by `Podfile`

Trying to use the latest version gives a different kind of error

Analyzing dependencies
[!] Unable to satisfy the following requirements:

- `XMLDictionary (= 1.4)` required by `Podfile.lock`
- `XMLDictionary (~> 1.4.0)` required by `AWSiOSSDKv2 (2.0.16)`

Specs satisfying the `XMLDictionary (= 1.4)` dependency were found, but they required a higher minimum deployment target.

We have over 10% of our users on iOS 7, and we can't change the deployment target

Here is my pod file

platform :ios, '7.0'
inhibit_all_warnings!

pod 'AWSiOSSDKv2' , '2.0.16'
pod 'CocoaLumberjack', '1.9.1'
pod 'DateTools', '1.4.3'
pod 'FXForms', '1.2.13'
pod 'Facebook-iOS-SDK', '4.0'
pod 'GoogleAnalytics-iOS-SDK' , '3.10'
pod 'JVFloatLabeledTextField',' 0.0.9'
pod 'MBProgressHUD', '0.9'
pod 'OCThumbor', '0.3.1'
pod 'PREBorderView', '2.0'
pod 'RCLocationManager', :git => 'https://github.com/rcabamo/RCLocationManager.git', :commit => 'd505b7451e'
pod 'SlackTextViewController', '1.7'
pod 'Toast', '2.4'
pod 'UAObfuscatedString', '0.2'
pod 'UIActionSheet+Blocks', '0.8.1'
pod 'UIAlertView+Blocks', '0.8.1'
pod 'OCMapper', '2.0'
pod 'CSStickyHeaderFlowLayout', '0.2.7'
pod 'Amplitude-iOS', '3.0'
pod 'AFNetworking', '2.5.4'
pod 'RSDayFlow', :git => 'https://github.com/aryaxt/RSDayFlow.git'
pod 'MCSwipeTableViewCell', '2.1.3'
pod 'SWTableViewCell', '0.3.7'

Is macOS expected to be supported?

It has been a long time since this library was released and there is still no support for macOS. For companies that support versions of applications for iOS and macOS, this imposes certain difficulties in the support of several analytic systems. Are there any plans to eliminate this shortcoming?

Undefined symbols for architecture i386

Hi,
I was trying to integrate Amplitude in my React-Native app but i receive this error:
Undefined symbols for architecture i386:
"OBJC_CLASS$_Amplitude", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386

I have to mention that at some point it was working, but not anymore.

Dependency Analysis Warnings

After updating to 3.14.0 I'm now seeing these warnings in Xcode:

Check dependencies

warning: no rule to process file '/Users/ian/Code/tt/ios/Pods/Amplitude-iOS/Amplitude/api.amplitude.com.der' of type file for architecture x86_64
warning: no rule to process file '/Users/ian/Code/tt/ios/Pods/Amplitude-iOS/Amplitude/ComodoCaLimitedRsaCertificationAuthority.der' of type file for architecture x86_64
warning: no rule to process file '/Users/ian/Code/tt/ios/Pods/Amplitude-iOS/Amplitude/ComodoRsaCA.der' of type file for architecture x86_64
warning: no rule to process file '/Users/ian/Code/tt/ios/Pods/Amplitude-iOS/Amplitude/ComodoRsaDomainValidationCA.der' of type file for architecture x86_64
warning: no rule to process file '/Users/ian/Code/tt/ios/Pods/Amplitude-iOS/Amplitude/SSLCertificatePinning/SSLCertificatePinning-Prefix.pch' of type sourcecode.c.h for architecture x86_64

logRevenue and track different currencies?

What's the proper way of tracking revenue and take different currencies into considerations? It doesn't seem like the existing methods accept the currency as a parameter

- (void)logRevenue:(NSString*) productIdentifier quantity:(NSInteger) quantity price:(NSNumber*) price

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.