Giter Site home page Giter Site logo

countly / countly-sdk-ios Goto Github PK

View Code? Open in Web Editor NEW
618.0 52.0 241.0 1.63 MB

Countly Product Analytics iOS SDK with macOS, watchOS and tvOS support.

Home Page: https://count.ly

License: MIT License

Objective-C 96.76% Ruby 0.72% Shell 1.33% Swift 1.20%
sdk objective-c tvos watchos analytics push-notifications rating crash-dump crash-reporting macos

countly-sdk-ios's People

Contributors

alinradut avatar angelix avatar ar2rsawseen avatar arifburakdemiray avatar arturskadikis avatar atilimcetin avatar busify avatar centrinvest avatar coryallegory avatar derekmoorecountly avatar dkasabwala avatar dsmo avatar erkanyildiz avatar gorkem-cetin avatar harrisg avatar hiltonc avatar iartem avatar ijunaid avatar lhunath avatar nesimtunc avatar ntadej avatar osoner avatar peterbrxwn avatar pronebird avatar tternes avatar turtledreams avatar undancer 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

countly-sdk-ios's Issues

crashTest3 doesn't work.

I found that crash caused by crashTest3 method can't be caught.

running on Xcode7 beta4, iOS 9 simulator.

Crash in Countly_OpenUDID

We are using Segment.iO

Stack trace

Fatal Exception: NSInvalidArgumentException NSInvalidArgumentException
+[UIPasteboard _accessibilityUseQuickSpeakPasteBoard]: unrecognized selector sent to class 0x3a201828

Countly_OpenUDID.m line 92
+[Countly_OpenUDID _getDictFromPasteboard:]

Countly_OpenUDID.m line 231
+[Countly_OpenUDID valueWithError:]
Countly.m line 477
-[ConnectionQueue beginSession]
CountlyProvider.m line 30
-[CountlyProvider start]
AnalyticsProvider.m line 36
-[AnalyticsProvider updateSettings:]
Analytics.m line 213
-[Analytics updateProvidersWithSettings:]
Analytics.m line 208
-[Analytics setCachedSettings:]
Analytics.m line 232
__28-[Analytics refreshSettings]_block_invoke_2

Release 16.02 won't compile (missing header)

The latest 16.02 release did not compile when I installed the latest pod.
The compile error is:

Pods/Countly/CountlyAPM.h:25:31: Unknown type name 'CountlyAPMNetworkLog' Pods/Countly/CountlyAPM.h:58:31: Unknown type name 'CountlyAPMNetworkLog'

It seems the #import CountlyAPMNetworkLog.h is missing in CountlyAPM.h

I also get an eror in CounlyCommon.h, complaining about #include <execinfo.h> and <ifaddrs.h> with the message:

Pods/Countly/CountlyCommon.h:60:10: Include of non-modular header inside framework module 'Countly.CountlyCommon'
Pods/Countly/CountlyCommon.h:64:9: Include of non-modular header inside framework module 'Countly.CountlyCommon'

This occurred with cocoapod 1.0.0.beta3 and beta4, Xcode 7.2.1

No unit tests

Confidence is always higher that a product performs as intended if it has thorough unit tests.

Push

Hi,

Where is that they are the methods because they are not declared in Countly.h ?

[[Countly sharedInstance] didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
[[Countly sharedInstance] didFailToRegisterForRemoteNotifications];

Thanks
Robert

Countly issue through the segment integration

This is a Countly issue, but through the segment integration. We recently had to downgrade our countly integration from 3.0.0 to 1.11.13 because of unhandled exceptions when [SEGAnalytics flushMessageQueue] was being called. Here’s part of our crash log:

Application Specific Information:
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSCFSet: 0x17067da00> was mutated while being enumerated.'

Last Exception Backtrace:
0   CoreFoundation                       0x00000001858102d8 __exceptionPreprocess + 132
1   libobjc.A.dylib                      0x000000019703c0e4 objc_exception_throw + 56
2   CoreFoundation                       0x000000018580fc8c __NSFastEnumerationMutationHandler + 136
3   CoreData                             0x00000001854f0018 -[NSSQLCore prepareForSave:] + 920
4   CoreData                             0x00000001854ef3e4 -[NSSQLCore saveChanges:] + 652
5   CoreData                             0x00000001854b70a0 -[NSSQLCore executeRequest:withContext:error:] + 716
6   CoreData                             0x0000000185583c08 __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke + 4128
7   CoreData                             0x000000018558c028 gutsOfBlockToNSPersistentStoreCoordinatorPerform + 180
8   libdispatch.dylib                    0x000000019768d954 _dispatch_client_callout + 12
9   libdispatch.dylib                    0x00000001976971e4 _dispatch_barrier_sync_f_invoke + 72
10  CoreData                             0x000000018557de98 _perform + 176
11  CoreData                             0x00000001854b6c5c -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 296
12  CoreData                             0x00000001854ddbf4 -[NSManagedObjectContext save:] + 1280
13  AA-DEV                     0x0000000100149144 -[CountlyDB saveContext] (CountlyDB.m:168)
14  AA-DEV                     0x0000000100148a4c -[CountlyDB createEvent:count:sum:segmentation:timestamp:] (CountlyDB.m:67)
15  AA-DEV                     0x0000000100141b70 -[CountlyEventQueue recordEvent:segmentation:count:] (Countly.m:546)
16  AA-DEV                     0x0000000100144d1c -[Countly recordEvent:segmentation:count:] (Countly.m:1053)
17  AA-DEV                     0x0000000100123a9c -[SEGCountlyIntegration track:properties:options:] (SEGCountlyIntegration.m:74)
18  AA-DEV                     0x0000000100123b50 -[SEGCountlyIntegration screen:properties:options:] (SEGCountlyIntegration.m:81)
19  CoreFoundation                       0x0000000185816100 __invoking___ + 140
20  CoreFoundation                       0x00000001857122fc -[NSInvocation invoke] + 292
21  CoreFoundation                       0x0000000185716e30 -[NSInvocation invokeWithTarget:] + 64
22  AA-DEV                     0x000000010011f8c8 -[SEGAnalytics invokeIntegration:selector:arguments:options:] (SEGAnalytics.m:401)
23  AA-DEV                     0x000000010011f5e4 -[SEGAnalytics forwardSelector:arguments:options:] (SEGAnalytics.m:366)
24  AA-DEV                     0x000000010011fee0 -[SEGAnalytics flushMessageQueue] (SEGAnalytics.m:426)
25  AA-DEV                     0x0000000100122744 seg_dispatch_specific (SEGAnalyticsUtils.m:60)
26  AA-DEV                     0x00000001001227a0 seg_dispatch_specific_async (SEGAnalyticsUtils.m:71)
27  AA-DEV                     0x000000010011ebe0 -[SEGAnalytics updateIntegrationsWithSettings:] (SEGAnalytics.m:279)
28  AA-DEV                     0x000000010011e9a0 -[SEGAnalytics setCachedSettings:] (SEGAnalytics.m:271)
29  AA-DEV                     0x000000010011ef98 __31-[SEGAnalytics refreshSettings]_block_invoke_2 (SEGAnalytics.m:301)
30  libdispatch.dylib                    0x000000019768d994 _dispatch_call_block_and_release + 20
31  libdispatch.dylib                    0x000000019768d954 _dispatch_client_callout + 12
32  libdispatch.dylib                    0x00000001976980a4 _dispatch_queue_drain + 1444
33  libdispatch.dylib                    0x0000000197690a5c _dispatch_queue_invoke + 128
34  libdispatch.dylib                    0x000000019769a318 _dispatch_root_queue_drain + 716
35  libdispatch.dylib                    0x000000019769bc4c _dispatch_worker_thread3 + 104
36  libsystem_pthread.dylib              0x000000019786d22c _pthread_wqthread + 812
37  libsystem_pthread.dylib              0x000000019786cef0 start_wqthread + 0

Since downgrading, we’ve had no crashes.

CocoaPods

Please add the framework to CocoaPods :)

Crash at CountlyConnectionManager tick

Crash is happening when removing not existing item in CountlyConnectionManager::tick

Fatal Exception: NSRangeException
*** -[__NSArrayM removeObjectAtIndex:]: index 0 beyond bounds for empty array
Fatal Exception: NSRangeException

0  CoreFoundation                 0x18220ee38 __exceptionPreprocess
1  libobjc.A.dylib                0x181873f80 objc_exception_throw
2  CoreFoundation                 0x1820ef084 -[__NSArrayI count]
3  ######                          0x100241b40 __32-[CountlyConnectionManager tick]_block_invoke (CountlyConnectionManager.m:90)
4  CFNetwork                      0x1827fb53c __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke
5  CFNetwork                      0x18280e0bc __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke
6  Foundation                     0x182bc8510 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
7  Foundation                     0x182b1a900 -[NSBlockOperation main]
8  Foundation                     0x182b0aed8 -[__NSOperationInternal _start:]
9  Foundation                     0x182bca904 __NSOQSchedule_f
10 libdispatch.dylib              0x181c5947c _dispatch_client_callout
11 libdispatch.dylib              0x181c654c0 _dispatch_queue_drain
12 libdispatch.dylib              0x181c5cf80 _dispatch_queue_invoke
13 libdispatch.dylib              0x181c67390 _dispatch_root_queue_drain
14 libdispatch.dylib              0x181c670b0 _dispatch_worker_thread3
15 libsystem_pthread.dylib        0x181e71470 _pthread_wqthread
16 libsystem_pthread.dylib        0x181e71020 start_wqthread

Crash on startup

I've just added the latest SDK update to my app, and on startup it crashes on line 97 of CountlyPersistency.m

*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x7f8ad0e02b50> was mutated while being enumerated.'

Enable Debug from external class

Hi,

It would be great to be able to enable debugging in Countly.m from an external class. Something like:

-(void)setDebug:(BOOL)debugVar

Crash when dismissing push notification alerts

Sending push notifications from Countly (Community Edition), for example one that should open a URL, simply crashes when I tap "Open" on the UIAlertView that comes up.

The crash occurs on line 984 of Countly.m:
[self recordPushActionForCountlyDictionary:info[@"c"]];

Watchkit compile errors

I've just updated a current project with the latest version of the iOS SDK and added it to a WatchKit target.
I am getting a couple of errors in CountlyDB.m. First of all, line 85, Use of undeclared identifier 'WKInterfaceDevice'
I don't see you importing WatchKit anywhere in CountlyDB.m

As a workaround, i've added #import <WatchKit/WatchKit.h> to line 22 underneath #if COUNTLY_TARGET_WATCHKIT

The final 2 errors are on line 86 postData = [postData stringByAppendingFormat:@"&segment=%@", CountlyURLEscapedString(segmentation)];
Error: Implicit declaration of function 'CountlyURLEscapedString' is invalid in C99
Warning: Format specifies type 'id' but the argument has type 'int'

I'm not sure how to fix this.

Thanks

Crash reporting broken

  1. CrashReporting.mm CountlyExceptionHandler code is using HTTPMethod POST and passing everything including app_key, device_id, and crash inside of HTTPBody. When testing this with try.count.ly, server response with an error message: "Missing app_key or device_id". I have tested and the only thing that works with try.count.ly is if you use GET and put everything in the query string.
  2. Error handling is wrong: after sending sendSynchronousRequest, code checks error and recvData variables, but does not check the dictionary that server returns. So in this case when server is not returning Success, the crash report is actually being lost.
  3. Even if #2 did have the correct check for the server reply, current implementation calls sendCrashReportLater, which in-turn will call saveToFile. However, this saveToFile function actually does a dispatch_async, and, since the application is being terminated, will actually never be called. Hence another bug, when crash report will be lost.
  4. saveToFile is problematic since it uses a dispatch_async. For example, if application is about to terminate, this will be called to save the events to a file. However, since it's using dispatch_async, it is not guaranteed that the code will actually complete, hence there is a potential for event loss. This is actually quite easy to reproduce, put in a [NSThread sleepForTimeInterval:5.0] inside of saveToFile dispatch_async, accumulate some events, and kill the application, those events will be lost.

Pod not usable from Swift

Please add

s.public_header_files = 'Countly.h', 'CountlyUserDetails.h', 'CountlyConfig.h', 'CountlyCrashReporter.h'

to the spec so that it works from Swift also.

Kind regards,
Markus

app_key is saved as part of persistance file

This is a potential bug, here's the scenario where this is really bad:

Let's say you have a client application that is using specific app_key, they already have an established user base as well. These users might have some countly requests stored that have not been synced yet. Now, application developer changes their app_key and removes old app_key. Users get the updated application with the new app key, however queued up requests with the old app_key are now failing and will never get cleared up in this case. Also, new events will never get delivered either since they are in the back of the queue.... Clients will stop sending events at this point and the event file keeps growing.

recordUserDetails - NSURLConnection delegate thread problem

I am having some problems with iOS SDK on Countly Enterprise Edition v15.08

Everything works fine until I run a Countly recordUserDetails

Normal events run like so:

[INFO] : Request Started
[INFO] : http://host.com/i?app_key=1a0ea80f9fbd51f457f76adfa5a614e6fc9da024&device_id=7a017c22435ef78d3fdbffd561c25f0a7a9b9c4e&timestamp=1444728697&events=%5B%7B%22key%22%3A%22keySegmentationCountSum%22%2C%22count%22%3A1%2C%22segmentation%22%3A%7B%22device%22%3A%22iPhone%204S%22%2C%22country%22%3A%22USA%22%7D%2C%22timestamp%22%3A1444728675%2C%22sum%22%3A0.99%7D%5D
[INFO] : Request Completed

but when I run a recordUserDetails event the SDK NEVER receives the [INFO] : Request Completed message and no other events are sent

Events still get recorded but never get sent to the server - seems that the recordUserDetails request to the server just never completes and then it cant send any other events.

I have also tried sending less userinfo - ie only a name and it does the same. I also tried this on different apps - they all do the same thing.

[INFO] : -[Countly recordUserDetails:]
[INFO] : Extracted picturePath: /images/appicon.png
[INFO] : picturePath: /images/appicon.png
[INFO] : Request Started
[INFO] : http://host.com/i?app_key=1a0ea80f9fbd51f457f76adfa5a614e6fc9da024&device_id=7a017c22435ef78d3fdbffd561c25f0a7a9b9c4e&timestamp=1444728720&sdk_version=15.06.01&user_details=%7B%22organization%22%3A%22testOrg%22%2C%22custom%22%3A%7B%22key2%22%3A%22value2%22%2C%22key1%22% 3A%22value1%22%7D%2C%22name%22%3A%22testName%22%2C%22phone%22%3A%22testPhone%22%2C%22gender%22%3A%22M%22%2C%22picture%22%3A%22https%3A%5C%2F%5C%2Fcount.ly%5C%2Fwp-content%5C%2Fuploads%5C%2F2014%5C%2F10%5C%2Flogo.png%22%2C%22email%22%3A%22testemail%40gmail.com%22%2C%22picturePath%22%3A%22%5C%2Fimages%5C%2Fappicon.png%22%2C%22byear%22%3A1980%2C%22username%22%3A%22testUsername%22%7D

Here is another example where I only sent the Custom Data key1 = value1 and key2 = value2

It also never receives the reply...

Custom Data sent:

[INFO] : {
[INFO] : custom = {
[INFO] : key1 = value1;
[INFO] : key2 = value2;
[INFO] : };
[INFO] : } userDetails
[INFO] : -[Countly recordUserDetails:]
[INFO] : device_udid stored - no need to generate
[INFO] : device_udid 7a017c22435ef78d3fdbffd561c25f0a7a9b9c4e
[INFO] : Request Started
[INFO] : http://host.com/i?app_key=1a0ea80f9fbd51f457f76adfa5a614e6fc9da024&device_id=7a017c22435ef78d3fdbffd561c25f0a7a9b9c4e&timestamp=1444729383&sdk_version=15.06.01&user_details=%7B%22custom%22%3A%7B%22key2%22%3A%22value2%22%2C%22key1%22%3A%22value1%22%7D%7D

I believe events like
[CountlyConnectionQueue.sharedInstance sendUserDetails];
[CountlyConnectionQueue sharedInstance] recordEvents:[eventQueue events]];

are initiated on a different thread than what the NSURLConnection delegates were created on? Then the connectionDidFinishLoading is never run as its on a different thread.

APM properties in iOS SDK

Adding app performance management related properties in SDK:

  1. Events having a time associated with them. This would give the total time for a specific network activity and helps understand delays
  2. Data volume for each network activity

ATS in withAppStoreId method

It might be worth changing the iTunes.apple.com request in Contly.m to use https so it works with App Transport Security.

Fix iOS 9 Deprecation Warnings

Countly uses UIAlertView and [NSURLConnection sendSynchronousRequest:returningResponse:error:] which were deprecated with iOS 9.

screen shot 2016-08-19 at 16 20 59

Crash in [CountlyDB persistentStoreCoordinator]

I've just added this sdk to my project by cocoapods and it crashes.

2014-01-21 23:16:24.444 Подслушано[83407:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot create an NSPersistentStoreCoordinator with a nil model'
*** First throw call stack:
(
0 CoreFoundation 0x034855e4 exceptionPreprocess + 180
1 libobjc.A.dylib 0x031dd8b6 objc_exception_throw + 44
2 CoreData 0x00c3cb0e -[NSPersistentStoreCoordinator initWithManagedObjectModel:] + 398
3 –ü–æ–¥—Å–ª—É—à–∞–Ω–æ 0x000bde0f __39-[CountlyDB persistentStoreCoordinator]_block_invoke + 223
4 libdispatch.dylib 0x048f94b0 _dispatch_client_callout + 14
5 libdispatch.dylib 0x048e8e17 dispatch_once_f + 182
6 libdispatch.dylib 0x048e8d5c dispatch_once + 31
7 –ü–æ–¥—Å–ª—É—à–∞–Ω–æ 0x000bdd13 -[CountlyDB persistentStoreCoordinator] + 163
8 –ü–æ–¥—Å–ª—É—à–∞–Ω–æ 0x000bda30 __33-[CountlyDB managedObjectContext]_block_invoke + 48
9 libdispatch.dylib 0x048f94b0 _dispatch_client_callout + 14
10 libdispatch.dylib 0x048e8e17 dispatch_once_f + 182
11 libdispatch.dylib 0x048e8d5c dispatch_once + 31
12 –ü–æ–¥—Å–ª—É—à–∞–Ω–æ 0x000bd9e3 -[CountlyDB managedObjectContext] + 163
13 –ü–æ–¥—Å–ª—É—à–∞–Ω–æ 0x000bd20b -[CountlyDB addToQueue:] + 75
14 –ü–æ–¥—Å–ª—É—à–∞–Ω–æ 0x000bb5ca -[CountlyConnectionQueue beginSession] + 266
15 –ü–æ–¥—Å–ª—É—à–∞–Ω–æ 0x000bc3dd -[Countly start:withHost:] + 333
16 –ü–æ–¥—Å–ª—É—à–∞–Ω–æ 0x000030d5 StartTrackingSession + 133
17 –ü–æ–¥—Å–ª—É—à–∞–Ω–æ 0x000034d7 -[AppDelegate application:didFinishLaunchingWithOptions:] + 103
18 UIKit 0x02214355 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309
19 UIKit 0x02214b95 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1536
20 UIKit 0x022193a8 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
21 UIKit 0x0222d87c -[UIApplication handleEvent:withNewEvent:] + 3447
22 UIKit 0x0222dde9 -[UIApplication sendEvent:] + 85
23 UIKit 0x0221b025 _UIApplicationHandleEvent + 736
24 GraphicsServices 0x042d92f6 _PurpleEventCallback + 776
25 GraphicsServices 0x042d8e01 PurpleEventCallback + 46
26 CoreFoundation 0x03400d65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION
+ 53
27 CoreFoundation 0x03400a9b __CFRunLoopDoSource1 + 523
28 CoreFoundation 0x0342b77c __CFRunLoopRun + 2156
29 CoreFoundation 0x0342aac3 CFRunLoopRunSpecific + 467
30 CoreFoundation 0x0342a8db CFRunLoopRunInMode + 123
31 UIKit 0x02218add -[UIApplication _run] + 840
32 UIKit 0x0221ad3b UIApplicationMain + 1225
33 –ü–æ–¥—Å–ª—É—à–∞–Ω–æ 0x0000f4bd main + 141
34 libdyld.dylib 0x04b8b70d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Podfile:
...
pod 'Countly'

As I see there is no 'Countly.xcdatamodeld' file in my Pods subproject.

NSURLProtocol

This sdk with a custom NSURLProtocol conflict, use only one

recordUserDetails should have it's counterpart to safely update custom properties

SDK should allow to query current user details
- (NSDictionary *)currentUserDetails

Use case for that:

  1. I'm setting custom property on user upon initialization:
    [[Countly sharedInstance] recordUserDetails:@{kCLYUserCustom: @{@"prop": @1}}]
  2. Then in completely different part of the app I want to set another property:
    [[Countly sharedInstance] recordUserDetails:@{kCLYUserCustom: @{@"prop2": @"another"}}]

Which apparently wipes my first property.

Proposed approach is to query currentUserDetails and update this collection as necessary, then perform
[[Countly sharedInstance] recordUserDetails:adjustedUserDetails]

Another possible solution is to iterate kCLYUserCustom inside SDK and update keys in the same fashion as predefined keys (e.g. name or birthday) -- checking if they are non-nil before updating.

Would be happy to make PR, just let me know what approach is preferred.

Add semantic version tagging

Countly was added to the CocoaPods package manager repo.

CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.

However, Countly doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.

Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.

In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:

$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags

POST method requests do not support Asian characters

Upgraded to 16.06 SDK, and what worked before now is broken due to the following server error:

Parse events JSON failed [{"dur":0,"hour":14,"segmentation":{"track":"e(f0e , f4>e    d?
\/TRY (e
e$ g
h23e(gd8;i!
           f) - Kung Fu Panda 3 Official Theme Song"},"count":1,"key":"PlayTrack","timestamp":1467495918,"dow":6,"sum":0}] /i app_key=<app-key>&device_id=<device-id>&timestamp=1467495935&hour=14&dow=6&sdk_version=16.06&sdk_name=objc-native-ios&events=[{"dur":0,"hour":14,"segmentation":{"track":"周杰倫, 派偉俊\/TRY (功夫熊貓3全球主題曲) - Kung Fu Panda 3 Official Theme Song"},"count":1,"key":"PlayTrack","timestamp":1467495918,"dow":6,"sum":0}]

Apparently, the issue is related to the Asian characters in the request.

Another thing I also noticed is that, this commit c0b8ce6 makes all requests with POST method, however, when I checked on the API reference http://resources.count.ly/docs/i, it is still a GET method.

Countly Messaging crash - OpenUDID

The crash below only happens the FIRST time you open the app and the user accepts the prompt to Subscribe to Push - after the initial crash it works fine....

Apps crash every now and then when registering for push notifications. Sometimes it works and sometimes it fails and crashed 80% of the time.

After a lot of debugging I think I have narrowed it down to OPENUDID.

When the "data" for the "tokenSession" is created as below it tries to generate the "device_id" via "[CountlyDeviceInfo udid]"

NSString *data = [NSString stringWithFormat:@"app_key=%@&device_id=%@&timestamp=%ld&sdk_version="COUNTLY_SDK_VERSION"&token_session=1&ios_token=%@&test_mode=%d",
                      self.appKey,
                      [CountlyDeviceInfo udid],
                      time(NULL),
                      [token length] ? token : @"",
                      testMode];

What happens is that OpenUDID does not return a string but crashes with the following error:

ly.count.appcelerator[2616] <Warning>: Sending APN token in mode 1
ly.count.appcelerator[2616]: objc[2616]: pthread_rwlock_rdlock failed (11)

Sometimes it does not just crash but gets stuck in a loop with "[CountlyDeviceInfo udid]" returning as below:

{     "Create Time" = "464935993.428005";
        Expiry = inf;
        "HSTS Host" = 1;
        "Include Subdomains" = 1;
    }

I have tried many other things and every time I run "[CountlyDeviceInfo udid]" inside the (void)tokenSession:(NSString *)token function it causes the app to hang and crash...

Here are some more logs below:

ly.count.appcelerator[2381] <Warning>: Request Started
     http://host.com/i?app_key=my_app_key_removed&device_id={
        "Create Time" = "464933394.465819";
        Expiry = inf;
        "HSTS Host" = 1;
    }&timestamp=1443240598&sdk_version=15.06.01&token_session=1&ios_token=my_ios_key_removed&test_mode=1

ly.count.appcelerator[2338] <Warning>: Request Failed
     <NSManagedObject: 0x17d7b850> (entity: Data; id: 0x17d80330 <x-coredata://761E5C6F-919A-4D77-8602-AD69FD341D93/Data/p2> ; data: {
        post = "app_key=my_app_key_removed&device_id={\n    \"Create Time\" = \"464931768.777818\";\n    Expiry = inf;\n    \"HSTS Host\" = 1;\n}&timestamp=1443238972&sdk_version=15.06.01&token_session=1&";
    }): Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSUnderlyingError=0x17d83550 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 "unsupported URL" UserInfo={NSLocalizedDescription=unsupported URL}}, NSLocalizedDescription=unsupported URL}

Some times it returns a correct UDID like below but most of the time it fails and then the app crashes.

ly.count.appcelerator[2365] <Warning>: Request Started
     http://host.com/i?app_key=my_app_key_removed&device_id=6a016c22435eg78d3fdbffd571c25f0a7a9b9c4e&timestamp=1443239731&sdk_version=15.06.01&begin_session=1&metrics=%7B%22_app_version%22%3A%221.0%22%2C%22_os%22%3A%22iOS%22%2C%22_locale%22%3A%22zh_CN%22%2C%22_os_version%22%3A%229.0%22%2C%22_device%22%3A%22iPad3%2C4%22%2C%22_resolution%22%3A%221536x2048%22%7D

I see that OpenUDID is depregated - so I dont know if this is creating problems.
http://blog.appsfire.com/udid-is-dead-openudid-is-deprecated-long-live-advertisingidentifier/

I spent some time looking at solutions and saw that the "[CountlyDeviceInfo udid]" command is used by the sessions_started event just before this and it does return the device_id - it seems like there is a threading problem or something.

I also saw someone else having this problem suggest to simply get the Device ID once via [CountlyDeviceInfo udid] and then store it on the device and simply retrieve that value rather than generating it every time?

tvOS Support

SDK will not compile under tvOS target. Are there any plans to add support for it?

redefinition of macro TARGET_OS_OSX

When built under Xcode 8, I am getting the following compilation error:

In file included from /Users/jboehle/Desktop/projects/ios/libexternal/Countly/Countly.m:9:
/Users/jboehle/Desktop/projects/ios/libexternal/Countly/CountlyCommon.h:50:9: error: 'TARGET_OS_OSX' macro redefined [-Werror,-Wmacro-redefined]

define TARGET_OS_OSX (!(TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH))

    ^

In module 'Foundation' imported from /Users/jboehle/Desktop/projects/ios/libexternal/Countly/CountlyCommon.h:7:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/TargetConditionals.h:98:13: note: previous definition is here
#define TARGET_OS_OSX 0
^
1 error generated.

Eclipse/Titanium Development Build never sets testMode to 1

When Building our app under Eclipse/Titanium, Development Build never sets testMode to 1

I guess OPTIMIZE is being set even in Development Build.

 // Test modes: 0 = production mode, 1 = development build, 2 = Ad Hoc build
    int testMode;
#ifndef __OPTIMIZE__
    testMode = 1;
#else
    testMode = self.startedWithTest ? 2 : 0;
#endif

I like the the idea of trying to detect for production, Ad Hoc or Development but I have only ever seen Production and Development detection. If we only checked for those two it would be simple.

I really dont want to have to edit the Countly.m SDK files to make this work in Titanium.

I will update if I find a solution

Crash at CountlyPersistency addToQueue

Fatal Exception: NSRangeException
0  CoreFoundation                 0x21d6798b __exceptionPreprocess
1  libobjc.A.dylib                0x21502e17 objc_exception_throw
2  CoreFoundation                 0x21c7cead CFStringConvertNSStringEncodingToEncoding
3  XXXXX                          0x2b5131 -[CountlyPersistency addToQueue:] (CountlyPersistency.m:58)
4  XXXXX                          0x2b129f -[CountlyConnectionManager endSessionWithDuration:] (CountlyConnectionManager.m:138)
5  XXXXX                          0x2aac41 -[Countly suspend] (Countly.m:336)
6  CoreFoundation                 0x21d197d5 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
7  CoreFoundation                 0x21d191df _CFXRegistrationPost
8  CoreFoundation                 0x21d18fbd ___CFXNotificationPost_block_invoke
9  CoreFoundation                 0x21d6fcdb -[_CFXNotificationRegistrar find:object:observer:enumerator:]
10 CoreFoundation                 0x21c79143 _CFXNotificationPost
11 Foundation                     0x224ba70f -[NSNotificationCenter postNotificationName:object:userInfo:]
12 UIKit                          0x26578a3b __47-[UIApplication _applicationDidEnterBackground]_block_invoke
13 UIKit                          0x2664068b +[UIViewController _performWithoutDeferringTransitions:]
14 UIKit                          0x2657889f -[UIApplication _applicationDidEnterBackground]
15 UIKit                          0x26578deb -[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]
16 UIKit                          0x26587803 __88-[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:]_block_invoke
17 UIKit                          0x2658775f -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:]
18 UIKit                          0x26573353 __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke
19 UIKit                          0x26573041 -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]
20 FrontBoardServices             0x233efcf5 __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke_2
21 FrontBoardServices             0x2340ac07 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
22 FrontBoardServices             0x2340aab9 -[FBSSerialQueue _performNext]
23 FrontBoardServices             0x233f34cd -[FBSWorkspace synchronizeSystemAnimationFencesWithCleanUpBlock:]
24 UIKit                          0x26570b41 -[UIApplication _synchronizeSystemAnimationFencesWithSpinCleanUpBlock:]
25 UIKit                          0x265c366d __realPreCommitHandler_block_invoke
26 QuartzCore                     0x243aa247 CA::Transaction::Fence::run_callbacks() const
27 QuartzCore                     0x2437068f CA::Context::commit_transaction(CA::Transaction*)
28 QuartzCore                     0x24370233 CA::Transaction::commit()
29 QuartzCore                     0x2436988b CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
30 CoreFoundation                 0x21d29739 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
31 CoreFoundation                 0x21d27a3d __CFRunLoopDoObservers
32 CoreFoundation                 0x21d27e6f __CFRunLoopRun
33 CoreFoundation                 0x21c772e9 CFRunLoopRunSpecific
34 CoreFoundation                 0x21c770d5 CFRunLoopRunInMode
35 GraphicsServices               0x23267ac9 GSEventRunModal
36 UIKit                          0x2633c0b9 UIApplicationMain
37 Primo                          0x202399 main (main.m:14)
38 libdispatch.dylib              0x2191f873 (Missing)

iOS 9 deprecated methods

The SDK gives some warnings on iOS 9.

  • CFURLCreateStringByAddingPercentEscapes
  • stringByReplacingPercentEscapesUsingEncoding:
  • connectionWithRequest:delegate:
  • UIAlertView
  • sendSynchronousRequest:returningResponse:error:

All are deprecated.

CountlyViewTracking

hi
image

image

If a controller contains a controller, it can not be associated, this can only be a separate monitor

CountlyViewTracking.m

Terminated due to signal 9

Countly crash application with this message: "Terminated due to signal 9" where i press home button (hide application).

CountlyViewTracking

CountlyViewTracking

self.exceptionViewControllers =
@[
@"CLYInternalViewController",
@"UINavigationController",
@"UIAlertController",
@"UIPageViewController",
@"UITabBarController",
@"UIReferenceLibraryViewController",
@"UISplitViewController",
@"UIInputViewController",
@"UISearchController",
@"UISearchContainerViewController",
@"UIApplicationRotationFollowingController",
@"_UIAlertControllerTextFieldViewController"
].mutableCopy;

Need to add @“_UIAlertControllerTextFieldViewController” ???
Are there other special circumstances?

Countly APM(CLYAPM) conflict with AFNetworking.

Versions:

  • AFNetworking: 3.1.0
  • Countly: 16.02
  • Tested iOS Version: 9.3.1(Simulator and iPhone 6), 8.4(Simulator only)

When I open CLYAPM and request HTTP use AFNetworking, I got nothing.

    CountlyConfig* config = [[CountlyConfig alloc] init];
    config.appKey = @"bba97f2234731c3586b70e6f56641c308893260f";
    config.host = @"http://countly.ineva.cn";

// AFNetworking error:
    config.features = @[CLYMessaging, CLYCrashReporting, CLYAPM, CLYViewTracking];

//  AFNetworking works:
//    config.features = @[CLYMessaging, CLYCrashReporting, CLYViewTracking];

    config.launchOptions = launchOptions;
    config.forceDeviceIDInitialization = YES;
    config.updateSessionPeriod = DEBUG ? 3 : 60 * 5;
    [Countly.sharedInstance startWithConfig:config];

Don't store database in Documents folder.

Storing the database file in the documents folder means that apps that have document sharing with iTunes enabled will expose this database to the user. It should instead be placed in an appropriate location in Library.

Request: Replacing Event in Countly.m to CountlyEvent class

I have this error where Xcode tells me that:

ld: 2 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I did some digging (many hours involved) and found out that I have a CoreData Model Class called Event, which also exists inside the Countly.m file. This is causing the compiler to go nuts on me.

Thus, I would like to put in a request to change the Event class inside the Countly.m file to CountlyEvent

Countly 16.02 Broken in CocoaPods 1.0.0

I get this error when trying to add "import Countly" in my Swift Project
screen shot 2016-05-23 at 11 02 12 am
Also tried to add in Bridging Header to test my luck but got "Could not build module 'Countly'" Error

Countly APM with AFNetworking, the callback do not work

AFNetworking : 3.1.0
Countly : 16.12
iOS : 10.2 Simulator

when the GET and POST has callback, the block do not work, this is the test code

            {
                AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
                manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html",@"text/json",@"text/plain",@"text/javascript",@"application/json", nil];
                NSLog(@"AFNetworking begin");
                [manager GET:@"https://www.google.com" parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
                    NSLog(@"----------------------%@",responseObject);
                } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
                    NSLog(@"_------------------------------------err-------%@", error);
                }];
            }

the log

2017-02-21 14:07:41.902 CountlyTestApp-iOS[32445:4271426] Test: APM - testAFN
2017-02-21 14:07:41.910 CountlyTestApp-iOS[32445:4271426] AFNetworking begin
2017-02-21 14:07:41.914 CountlyTestApp-iOS[32445:4271426] taskId=1
2017-02-21 14:07:43.134 CountlyTestApp-iOS[32445:4271502] [Countly] APM log recorded:
Request <0x60000001d640>
Request host: www.google.com
Request path:
Start Time: 1487657261.911667
End Time: 1487657263.133930
Time Elapsed: 1.222263
HTTP Status Code: 200
Sent Data Size: 106
Received Data Size: 10645
Connection Type: 1
Request Successful: 1

paste the AFNetworking source code

  • (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
    uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock
    downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock
    completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler {
__block NSURLSessionDataTask *dataTask = nil;
url_session_manager_create_task_safely(^{
    dataTask = [self.session dataTaskWithRequest:request];
});

[self addDelegateForDataTask:dataTask uploadProgress:uploadProgressBlock downloadProgress:downloadProgressBlock completionHandler:completionHandler];

return dataTask;

}

Are they has some conflict ?

sharedApplication is unavailable in iOS extension

I am updating an old project that has both an Today Widget extension and also a WatchKit v1 extension.

I get a compiler error in CountlyDeviceInfo.m on line 385 in this method

+ (BOOL)isInBackground
{
#if TARGET_OS_IOS
    return UIApplication.sharedApplication.applicationState == UIApplicationStateBackground;
#else
    return NO;
#endif
}

saying sharedApplication is unavailable.

cfstring leak fix !

Hi.
I get memory leak in CFUUIDCreateString after xcode project analyzing. Seems the 'cfstring' is never released.
I suggest releasing 'cfstring' adding: CFRelease(cfstring) after 147 codeline in 'Countly_OpenUDID.m'

Release 15.0.6 on CocoaPods

The 3.0.0 tag was deleted so CocoaPods can't install that, while 15.0.6 is not published on CocoaPods yet.

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.