{"action":"opened","issue":{"url":"https://api.github.com/repos/mixpanel/mixpanel-iphone/issues/333","labels_url":"https://api.github.com/repos/mixpanel/mixpanel-iphone/issues/333/labels{/name}","comments_url":"https://api.github.com/repos/mixpanel/mixpanel-iphone/issues/333/comments","events_url":"https://api.github.com/repos/mixpanel/mixpanel-iphone/issues/333/events","html_url":"https://github.com/mixpanel/mixpanel-iphone/issues/333","id":104372661,"number":333,"title":"Crash when fetching device model","user":{"login":"ryanseams","id":9201737,"avatar_url":"https://avatars.githubusercontent.com/u/9201737?v=3","gravatar_id":"","url":"https://api.github.com/users/ryanseams","html_url":"https://github.com/ryanseams","followers_url":"https://api.github.com/users/ryanseams/followers","following_url":"https://api.github.com/users/ryanseams/following{/other_user}","gists_url":"https://api.github.com/users/ryanseams/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanseams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanseams/subscriptions","organizations_url":"https://api.github.com/users/ryanseams/orgs","repos_url":"https://api.github.com/users/ryanseams/repos","events_url":"https://api.github.com/users/ryanseams/events{/privacy}","received_events_url":"https://api.github.com/users/ryanseams/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-01T23:14:16Z","updated_at":"2015-09-01T23:14:16Z","closed_at":null,"body":"Submitting this on behalf of a customer.\r\n\r\nCurrently their app is logging crashes when it accesses the line at https://github.com/mixpanel/mixpanel-iphone/blob/v2.6.2/Mixpanel/Mixpanel.m#L297 which can be found in the most recent release at https://github.com/mixpanel/mixpanel-iphone/blob/master/Mixpanel/Mixpanel.m#L871. Since this pod is old the issue could have been resolved, but since the code has not changed I wanted to post this here.\r\n\r\nSuggested fix by the customer is to handle this as an exception, but I might argue we simply ignore assignment of the property in this instance. Here is their fix:\r\n```\r\n- (NSString *)deviceModel \r\n{ \r\nsize_t size; \r\nsysctlbyname(\"hw.machine\", NULL, &size, NULL, 0); \r\nchar answer[size]; \r\n@try { \r\nsysctlbyname(\"hw.machine\", answer, &size, NULL, 0); \r\nNSString *results = @(answer); \r\nreturn results; \r\n} \r\n@catch (NSException *exception) { \r\nreturn @\"\"; \r\n} \r\n}\r\n```\r\n\r\nHere is the stack trace:\r\n0\t\r\nlibsystem_platform.dylib 0x0000000197585a80 OSAtomicDequeue + 8 \r\n1\t\r\nlibsystem_malloc.dylib 0x000000019752d064 nano_malloc + 40 \r\n2\t\r\nlibsystem_malloc.dylib 0x000000019751d3e4 malloc_zone_malloc + 112 \r\n3\t\r\nCoreFoundation 0x0000000184f96e08 _CFRuntimeCreateInstance + 372 \r\n4\t\r\nCoreFoundation 0x0000000185083f28 __CFStringCreateImmutableFunnel3 + 2196 \r\n5\t\r\nCoreFoundation 0x0000000184f9857c CFStringCreateWithBytes + 40 \r\n6\t\r\nFoundation 0x0000000185eca6b8 -[NSPlaceholderString initWithBytes:length:encoding:] + 140\r\n7\t\r\nFoundation 0x0000000185eca608 +[NSString stringWithUTF8String:] + 156 \r\n8\t\r\n**Redacted** 0x00000001002e9c8c -[Mixpanel deviceModel] (Mixpanel.m:297) \r\n9\t\r\n**Redacted** 0x00000001002f5a94 -[MixpanelPeople collectAutomaticPeopleProperties] (Mixpanel.m:1745) \r\n10\t\r\n**Redacted** 0x00000001002f5904 -[MixpanelPeople initWithMixpanel:] (Mixpanel.m:1730) \r\n11\t\r\n**Redacted** 0x00000001002e8f88 -[Mixpanel initWithToken:launchOptions:andFlushInterval:] (Mixpanel.m:138) \r\n12\t\r\n**Redacted** 0x00000001002e8e1c __50+[Mixpanel sharedInstanceWithToken:launchOptions:]_block_invoke (Mixpanel.m:111) \r\n13\t\r\nlibdispatch.dylib 0x00000001973ad954 _dispatch_client_callout + 12 \r\n14\t\r\nlibdispatch.dylib 0x00000001973ae82c dispatch_once_f + 92 \r\n15\t\r\n**Redacted** 0x00000001002e8dc0 +[Mixpanel sharedInstanceWithToken:launchOptions:] (once.h:68) \r\n16\t\r\n**Redacted** 0x00000001003cb4cc -[MTAppDelegate trackAppOpen] (MTAppDelegate.m:392) \r\n17\t\r\n**Redacted** 0x00000001003c8df0 -[MTAppDelegate application:didFinishLaunchingWithOptions:] (MTAppDelegate.m:103) \r\n18\t\r\n**Redacted** 0x000000010010c714 -[DAAppDelegate application:didFinishLaunchingWithOptions:] (DAAppDelegate.m:48) \r\n19\t\r\nUIKit 0x0000000189ba7124 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 400 \r\n20\t\r\nUIKit 0x0000000189dbe7e8 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2372 \r\n21\t\r\nUIKit 0x0000000189dc119c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1500 \r\n22\t\r\nUIKit 0x0000000189dbf70c -[UIApplication workspaceDidEndTransaction:] + 180 \r\n23\t\r\nFrontBoardServices 0x000000018d8f93c8 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 28 \r\n24\t\r\nCoreFoundation 0x000000018507427c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16 \r\n25\t\r\nCoreFoundation 0x0000000185073384 __CFRunLoopDoBlocks + 308 \r\n26\t\r\nCoreFoundation 0x00000001850719a8 __CFRunLoopRun + 1752"}}