11/04 UPDATE:
I've created a repo with an app that demonstrates just this problem below. Anyone who wants to install and play with it can find it here...
https://github.com/geirman/react-native-photo-emailer
I'm using the following packages together in an attempt to choose an image from the gallery (or take one using the camera), then attach that photo to an email.
react-native-image-picker
react-native-mail
The following code works great on Android, but fails to attach the image on iOS.
import ImagePicker from 'react-native-image-picker';
handleAndroid = (subject, to) => {
var pickerOptions = {
title: 'Select Avatar',
storageOptions: {
skipBackup: true,
path: 'images'
}
};
ImagePicker.showImagePicker(pickerOptions, (response) => {
const { uri, type, path } = response;
this.sendMail(subject, to, path, type);
});
}
And the sendMail method looks like this (minus error handling to simplify)
import Mailer from 'react-native-mail';
sendMail = (subject, to, uri, type) => {
Mailer.mail({
subject,
recipients: [to],
body: 'Optional Comment: ',
attachment: {
path: uri,
type: type,
name: subject
},
isHTML: true
}
}
Note that attachment.path must be the full file path to the attachment. For Android, that turns out to be the response.path, but iOS only returns response.uri.
For iOS's sendMail method, I remove attachment.name and attachment.type since they aren't returned, leaving just attachment.path which is set to the response.uri.
response.path (on Android) looks like this (this works)...
/storage/emulated/0/DCIM/Camera/IMG_20171102_11304344.jpg
response.uri (on iOS) looks like this (response.path does not return anything on iOS)...
file://var/mobile/Containers/Data/Application/983938D-5304-463C-BD05-D033E55F5BEB/Documents/images/224CA6DD-5299-48C3-A7CF-0B645004535F.jpg
But according to React native - send photo per mail, I want something that looks more like this (on iOS)...
/Users/anton/Library/Developer/CoreSimulator/Devices/9A15F203-9A58-41C5-A4FC-EA25FAAE92BD/data/Containers/Data/Application/79FF93F9-BA89-4F4C-8809-277BEECD447D/Documents/EFFF0ECE-4063-4FE5-984E-E76506788350.jpg
So my question is, how do I get the full path to the image on iOS from the above the response.uri value. In other words, how do I get something that looks more like what RNMail needs (e.g. /Users/anton...) from what ImagePicker returns (e.g. file://var/mobile...)?
Update:
I forgot to mention that I'm running these tests on actual devices. An Android Moto Z and iPhone 5s. This is necessary because emulators are useless when testing camera and email functionality.
Here's a dump of my xcode logs related to one session: initialize app > choose photo from gallery > email opens (nothing attached) > cancel > delete draft (throws an 'email failed to send' error, even if I send it I get this error though the email does actually send)
2017-11-02 20:12:45.310 [info][tid:main][RCTCxxBridge.mm:187] Initializing <RCTCxxBridge: 0x1c01b5fc0> (parent: <RCTBridge: 0x1c00babe0>, executor: (null))
2017-11-02 20:12:45.314031-0700 RNMail[434:92814] Initializing <RCTCxxBridge: 0x1c01b5fc0> (parent: <RCTBridge: 0x1c00babe0>, executor: (null))
2017-11-02 20:12:45.421 [warn][tid:main][RCTBridge.m:121] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
2017-11-02 20:12:45.421568-0700 RNMail[434:92814] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
2017-11-02 20:12:45.492 [warn][tid:main][RCTModuleData.mm:69] Module RNMail requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
2017-11-02 20:12:45.492054-0700 RNMail[434:92814] Module RNMail requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
2017-11-02 20:12:45.504 [info][tid:main][RCTRootView.m:301] Running application RNMail ({
initialProps = {
};
rootTag = 1;
})
2017-11-02 20:12:45.503900-0700 RNMail[434:92814] Running application RNMail ({
initialProps = {
};
rootTag = 1;
})
2017-11-02 20:12:45.537105-0700 RNMail[434:92814] refreshPreferences: HangTracerEnabled: 0
2017-11-02 20:12:45.537237-0700 RNMail[434:92814] refreshPreferences: HangTracerDuration: 500
2017-11-02 20:12:45.537355-0700 RNMail[434:92814] refreshPreferences: ActivationLoggingEnabled: 0 ActivationLoggingTaskedOffByDA:0
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 434, TID: 92857, Thread name: com.facebook.react.JavaScript, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4 RNMail 0x000000010026d2bc RCTCurrentAppBackgroundState + 220
5 RNMail 0x000000010026c7f8 -[RCTAppState constantsToExport] + 68
6 RNMail 0x0000000100275af4 -[RCTModuleData gatherConstants] + 724
7 RNMail 0x0000000100275ea8 -[RCTModuleData exportedConstants] + 36
8 RNMail 0x00000001002d312c _ZN8facebook5react15RCTNativeModule12getConstantsEv + 216
9 RNMail 0x000000010035764c _ZN8facebook5react14ModuleRegistry9getConfigERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 5864
10 RNMail 0x000000010038d8e0 _ZN8facebook5react16JSCNativeModules12createModuleERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPK15OpaqueJSContext + 492
11 RNMail 0x000000010038c5a0 _ZN8facebook5react16JSCNativeModules9getModuleEPK15OpaqueJSContextP14OpaqueJSString + 640
12 RNMail 0x00000001003708c0 _ZN8facebook5react11JSCExecutor15getNativeModuleEP13OpaqueJSValueP14OpaqueJSString + 268
13 RNMail 0x000000010037313c _ZZN8facebook5react12_GLOBAL__N_119exceptionWrapMethodIXadL_ZNS0_11JSCExecutor15getNativeModuleEP13OpaqueJSValueP14OpaqueJSStringEEEEPFPKS4_PK15OpaqueJSContextS5_S7_PS9_EvEN11funcWrapper4callESC_S5_S7_SD_ + 356
14 JavaScriptCore 0x000000018df6cdc4 <redacted> + 336
15 JavaScriptCore 0x000000018d950394 <redacted> + 3952
16 JavaScriptCore 0x000000018e052a94 <redacted> + 10612
17 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
18 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
19 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
20 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
21 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
22 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
23 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
24 JavaScriptCore 0x000000018e04ff50 <redacted> + 272
25 JavaScriptCore 0x000000018df35b94 <redacted> + 136
26 JavaScriptCore 0x000000018df0cb28 <redacted> + 11244
27 JavaScriptCore 0x000000018dc011ac _ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueERN3WTF8NakedPtrINS_9ExceptionEEE + 316
28 JavaScriptCore 0x000000018df6a558 JSEvaluateScript + 448
29 RNMail 0x00000001002fcc58 _ZN8facebook5react14evaluateScriptEPK15OpaqueJSContextP14OpaqueJSStringS5_ + 100
30 RNMail 0x000000010036d494 _ZN8facebook5react11JSCExecutor21loadApplicationScriptENSt3__110unique_ptrIKNS0_11JSBigStringENS2_14default_deleteIS5_EEEENS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 2528
31 RNMail 0x0000000100384d14 _ZZN8facebook5react16NativeToJsBridge15loadApplicationENSt3__110unique_ptrINS0_17JSModulesUnbundleENS2_14default_deleteIS4_EEEENS3_IKNS0_11JSBigStringENS5_IS9_EEEENS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEN3$_0clEPNS0_10JSExecutorE + 1372
32 RNMail 0x00000001003847ac _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN8facebook5react16NativeToJsBridge15loadApplicationENS_10unique_ptrINS4_17JSModulesUnbundleENS_14default_deleteIS7_EEEENS6_IKNS4_11JSBigStringENS8_ISC_EEEENS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEE3$_0PNS4_10JSExecutorEEEEvDpOT_ + 84
33 RNMail 0x0000000100383da0 _ZNSt3__110__function6__funcIZN8fa2017-11-02 20:12:46.253004-0700 RNMail[434:92857] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 434, TID: 92857, Thread name: com.facebook.react.JavaScript, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4 RNMail 0x000000010026d2bc RCTCurrentAppBackgroundState + 220
5 RNMail 0x000000010026c7f8 -[RCTAppState constantsToExport] + 68
6 RNMail 0x0000000100275af4 -[RCTModuleData gatherConstants] + 724
7 RNMail 0x0000000100275ea8 -[RCTModuleData exportedConstants] + 36
8 RNMail 0x00000001002d312c _ZN8facebook5react15RCTNativeModule12getConstantsEv + 216
9 RNMail 0x000000010035764c _ZN8facebook5react14ModuleRegistry9getConfigERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 5864
10 RNMail 0x000000010038d8e0 _ZN8facebook5react16JSCNativeModules12createModuleERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPK15OpaqueJSContext + 492
11 RNMail 0x000000010038c5a0 _ZN8facebook5react16JSCNativeModules9getModuleEPK15OpaqueJSContextP14OpaqueJSString + 640
12 RNMail 0x00000001003708c0 _ZN8facebook5react11JSCExecutor15getNativeModuleEP13OpaqueJSValueP14OpaqueJSString + 268
13 RNMail 0x000000010037313c _ZZN8facebook5react12_GLOBAL__N_119exceptionWrapMethodIXadL_ZNS0_11JSCExecutor15getNativeModuleEP13OpaqueJSValueP14OpaqueJSStringEEEEPFPKS4_PK15OpaqueJSContextS5_S7_PS9_EvEN11funcWrapper4callESC_S5_S7_SD_ + 356
14 JavaScriptCore 0x000000018df6cdc4 <redacted> + 336
15 JavaScriptCore 0x000000018d950394 <redacted> + 3952
16 JavaScriptCore 0x000000018e052a94 <redacted> + 10612
17 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
18 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
19 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
20 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
21 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
22 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
23 JavaScriptCore 0x000000018e056a94 <redacted> + 26996
24 JavaScriptCore 0x000000018e04ff50 <redacted> + 272
25 JavaScriptCore 0x000000018df35b94 <redacted> + 136
26 JavaScriptCore 0x000000018df0cb28 <redacted> + 11244
27 JavaScriptCore 0x000000018dc011ac _ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueERN3WTF8NakedPtrINS_9ExceptionEEE + 316
28 JavaScriptCore 0x000000018df6a558 JSEvaluateScript + 448
29 RNMail 0x00000001002fcc58 _ZN8facebook5react14evaluateScriptEPK15OpaqueJSContextP14OpaqueJSStringS5_ + 100
30 RNMail 0x000000010036d494 _ZN8facebook5react11JSCExecutor21loadApplicationScriptENSt3__110unique_ptrIKNS0_11JSBigStringENS2_14default_deleteIS5_EEEENS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 2528
31 RNMail 0x0000000100384d14 _ZZN8facebook5react16NativeToJsBridge15loadApplicationENSt3__110unique_ptrINS0_17JSModulesUnbundleENS2_14default_deleteIS4_EEEENS3_IKNS0_11JSBigStringENS5_IS9_EEEENS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEN3$_0clEPNS0_10JSExecutorE + 1372
32 RNMail 0x00000001003847ac _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN8facebook5react16NativeToJsBridge15loadApplicationENS_10unique_ptrINS4_17JSModulesUnbundleENS_14default_deleteIS7_EEEENS6_IKNS4_11JSBigStringENS8_ISC_EEEENS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEE3$_0PNS4_10JSExecutorEEEEvDpOT_ + 84
33 RNMail 0x0000000100383da0 _ZNSt3__110__function6__funcIZN8fa
2017-11-02 20:12:46.621 [info][tid:com.facebook.react.JavaScript] Running application "RNMail" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2017-11-02 20:12:46.621391-0700 RNMail[434:92857] Running application "RNMail" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2017-11-02 20:12:47.742027-0700 RNMail[434:92844] [] nw_connection_get_connected_socket 4 Connection has no connected handler
2017-11-02 20:12:47.742187-0700 RNMail[434:92844] TCP Conn 0x1c4170200 Failed : error 0:61 [61]
2017-11-02 20:12:50.900283-0700 RNMail[434:92848] [] nw_connection_get_connected_socket 5 Connection has no connected handler
2017-11-02 20:12:50.900432-0700 RNMail[434:92848] TCP Conn 0x1c0171400 Failed : error 0:61 [61]
2017-11-02 20:12:53.627866-0700 RNMail[434:92814] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-11-02 20:12:53.628903-0700 RNMail[434:92814] [MC] Reading from public effective user settings.
2017-11-02 20:12:54.060535-0700 RNMail[434:92843] [] nw_connection_get_connected_socket 6 Connection has no connected handler
2017-11-02 20:12:54.060707-0700 RNMail[434:92843] TCP Conn 0x1c416e400 Failed : error 0:61 [61]
2017-11-02 20:12:57.279004-0700 RNMail[434:92847] [] nw_connection_get_connected_socket 7 Connection has no connected handler
2017-11-02 20:12:57.279148-0700 RNMail[434:92847] TCP Conn 0x1c0172b40 Failed : error 0:61 [61]
2017-11-02 20:13:00.409536-0700 RNMail[434:92848] [discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}
2017-11-02 20:13:00.429314-0700 RNMail[434:93038] [] nw_connection_get_connected_socket 8 Connection has no connected handler
2017-11-02 20:13:00.429401-0700 RNMail[434:93038] TCP Conn 0x1c0171c40 Failed : error 0:61 [61]
2017-11-02 20:13:00.827 [info][tid:com.facebook.react.JavaScript] 'Response = ', { fileSize: 508257,
data: REMOVED_BASE64_STRING
timestamp: '2017-10-25T02:51:35Z',
uri: 'file:///var/mobile/Containers/Data/Application/144D1C48-C6D5-475A-891A-F75360CD64E2/Documents/images/0EF09235-6E04-4799-86F5-3E996ED4E439.jpg',
origURL: 'assets-library://asset/asset.JPG?id=EF345E7A-2DF1-49CA-875D-4208976A635B&ext=JPG',
isVertical: false,
height: 768,
width: 1024,
fileName: 'IMG_0003.JPG' }
2017-11-02 20:13:00.888025-0700 RNMail[434:92857] 'Response = ', { fileSize: 508257,
data: REMOVED_BASE64_STRING
2017-11-02 20:13:00.974189-0700 RNMail[434:92814] [MC] Filtering mail sheet accounts for bundle ID: org.reactjs.native.example.RNMail, source account management: 1
2017-11-02 20:13:00.985481-0700 RNMail[434:92814] [MC] Filtering mail sheet accounts for bundle ID: org.reactjs.native.example.RNMail, source account management: 1
2017-11-02 20:13:01.834117-0700 RNMail[434:92814] [MC] Lazy loading NSBundle MobileCoreServices.framework
2017-11-02 20:13:01.843828-0700 RNMail[434:92814] [MC] Loaded MobileCoreServices.framework
2017-11-02 20:13:04.218796-0700 RNMail[434:93034] [] nw_connection_get_connected_socket 9 Connection has no connected handler
2017-11-02 20:13:04.218943-0700 RNMail[434:93034] TCP Conn 0x1c01747c0 Failed : error 0:61 [61]
2017-11-02 20:13:07.341962-0700 RNMail[434:93036] [] nw_connection_get_connected_socket 10 Connection has no connected handler
2017-11-02 20:13:07.342107-0700 RNMail[434:93036] TCP Conn 0x1c0172540 Failed : error 0:61 [61]
2017-11-02 20:13:08.605 [info][tid:com.facebook.react.JavaScript] null
2017-11-02 20:13:08.606476-0700 RNMail[434:92857] null
2017-11-02 20:13:10.469212-0700 RNMail[434:93034] [] nw_connection_get_connected_socket 11 Connection has no connected handler
2017-11-02 20:13:10.469352-0700 RNMail[434:93034] TCP Conn 0x1c4174280 Failed : error 0:61 [61]
2017-11-02 20:13:11.144 [info][tid:com.facebook.react.JavaScript] OK: Email Error Response
2017-11-02 20:13:11.144088-0700 RNMail[434:92857] OK: Email Error Response
2017-11-02 20:13:13.599247-0700 RNMail[434:93036] [] nw_connection_get_connected_socket 12 Connection has no connected handler
2017-11-02 20:13:13.599391-0700 RNMail[434:93036] TCP Conn 0x1c0175480 Failed : error 0:61 [61]
Update 11/7/2017
At #Artal's suggestion, I started digging into the Xcode debugger. I found that the attachmentPath is assigned to fileData as an NSData type, then it's later used to actually attach the photo to the email. However, while it looks as though fileData is being assigned properly, as soon as I step one line further into the code, then fileData = nill somehow. Here's a few screenshots that step through the code.
#Artal set me on the right path, but this is the code that ultimately solved the problem...
Replace Line 82 of RNMail.m
NSData *fileData = [NSData dataWithContentsOfFile:attachmentPath];
With this code...
// Get the URL string, which is *not* a path (e.g. because it's file:// based)
NSString *attachmentURLString = [RCTConvert NSString:options[#"attachment"][#"path"]];
// Create a URL from the string
NSURL *attachmentURL = [[NSURLComponents componentsWithString:attachmentURLString] URL];
// Get the resource path and read the file using NSData
NSError *error = nil;
NSData *fileData = [NSData dataWithContentsOfURL:attachmentURL options:0 error:&error];
if(fileData == nil) {
// handle error
}
More information surrounding how this solution was arrived at, please see NSData Assignment Vanishes (becomes nil) Directly After Assigned
react-native-mail is using the NSData method dataWithContentsOfFile to create the attachment data for the email from the path parameter that you're providing (see here). dataWithContentsOfFile receives an absolute, string-based path, and not a path-based file URL like the one you're trying to use.
The "correct" path you provided with /Users/anton/Library/Developer... is a local path when used on a simulator. On a real device, you can expect it to look similar to the file path you provided which resides in your app's sandboxed Documents folder. The origURL by the way is a url to an internal assets library database which you can not load directly.
Simply removing the file:/ scheme from the string should solve your issue.
I’m using the base64 content of the picture instead of the url. Probably you can create an attachment with the same base64 content, after all that’s how email attachments work anyway
my app works fine when debugging on device and simulator ,but crashing during OTA and AD HOC distribution , I adding here my device log , Im getting the hidden error at the first line in thread 0 :
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001001435ac
Triggered by Thread: 0
Filtered syslog:
None found
Global Trace Buffer (reverse chronological seconds):
0.471355 CFNetwork 0x00000001839f9a80 TCP Conn 0x126183ed0 SSL Handshake DONE
0.705883 CFNetwork 0x00000001839f9990 TCP Conn 0x126183ed0 starting SSL negotiation
0.706739 CFNetwork 0x0000000183a9bf18 TCP Conn 0x126183ed0 complete. fd: 32, err: 0
0.708259 CFNetwork 0x0000000183a9d444 TCP Conn 0x126183ed0 event 1. err: 0
0.748479 CFNetwork 0x0000000183a9d51c TCP Conn 0x126183ed0 started
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 SimPlan 0x00000001001435ac __hidden#11038_ (__hidden#11355_:122)
1 UIKit 0x00000001888231b8 __47-[UIApplication _applicationDidEnterBackground]_block_invoke + 228
2 UIKit 0x00000001888f36d4 +[UIViewController _performWithoutDeferringTransitions:] + 128
3 UIKit 0x0000000188823080 -[UIApplication _applicationDidEnterBackground] + 100
4 UIKit 0x0000000188823604 -[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:] + 700
5 UIKit 0x0000000188833a80 -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:] + 448
6 UIKit 0x000000018881d70c __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 152
7 UIKit 0x000000018881d394 -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 712
8 FrontBoardServices 0x0000000184db77ac __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
9 FrontBoardServices 0x0000000184db7618 -[FBSSerialQueue _performNext] + 168
10 FrontBoardServices 0x0000000184db79c8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
11 CoreFoundation 0x00000001833cd09c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
12 CoreFoundation 0x00000001833ccb30 __CFRunLoopDoSources0 + 540
13 CoreFoundation 0x00000001833ca830 __CFRunLoopRun + 724
14 CoreFoundation 0x00000001832f4c50 CFRunLoopRunSpecific + 384
15 GraphicsServices 0x0000000184bdc088 GSEventRunModal + 180
16 UIKit 0x00000001885de088 UIApplicationMain + 204
17 SimPlan 0x000000010014184c main (__hidden#11355_:21)
18 libdyld.dylib 0x0000000182e928b8 start + 4
I try to debug with optimization level as suggest here :
Thanks for any help!
When use develop profile everything is ok.app can run in simulator and real phone.But when use distribution profile,it crashes in lauching page.And crashes only happened in distribution profile.So it sounds so strange.
What's more,I am using enterprise profile.
Here is the crash log.
Incident Identifier: 35311121-D805-45AC-86D4-0F2D23FC6A0F
CrashReporter Key: d5d38df3c00b48e5d091b65c20d5ab3c373c35fd
Hardware Model: iPhone6,2
Process: GSD_ZHIFUBAO [271]
Path: /private/var/mobile/Containers/Bundle/Application/A36A0DCC-178E-4251-B611-F8C163EB705F/GSD_ZHIFUBAO.app/GSD_ZHIFUBAO
Identifier: com.nice.one
Version: 6 (2.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2016-01-19 16:05:32.32 +0800
Launch Time: 2016-01-19 16:05:30.30 +0800
OS Version: iOS 9.2 (13C75)
Report Version: 105
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000010
Triggered by Thread: 0
Filtered syslog:
None found
Last Exception Backtrace:
0 CoreFoundation 0x184161900 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x1837cff80 objc_exception_throw + 56
2 CoreFoundation 0x184161848 +[NSException raise:format:] + 120
3 GSD_ZHIFUBAO 0x1004677d4 UmengSignalHandler + 144
4 libsystem_platform.dylib 0x183dc593c _sigtramp + 52
5 Foundation 0x184b0af40 ____addOperations_block_invoke + 328
6 Foundation 0x184b08c84 __addOperations + 292
7 GSD_ZHIFUBAO 0x1000a5738 -[NetworkClient postPath:baseUrl:parameters:attachHeaders:isDelete:completion:failure:] (NetworkClient.m:287)
8 GSD_ZHIFUBAO 0x100095b78 -[Netclient postUserinfo:failureBlock:] (Netclient.m:68)
9 GSD_ZHIFUBAO 0x1000427e0 -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:172)
10 UIKit 0x188ec9704 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 400
11 UIKit 0x1890f8130 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2904
12 UIKit 0x1890fc4b8 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1672
13 UIKit 0x1890f95c0 -[UIApplication workspaceDidEndTransaction:] + 168
14 FrontBoardServices 0x185717790 -[FBSSerialQueue _performNext] + 184
15 FrontBoardServices 0x185717b10 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
16 CoreFoundation 0x184118efc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
17 CoreFoundation 0x184118990 __CFRunLoopDoSources0 + 540
18 CoreFoundation 0x184116690 __CFRunLoopRun + 724
19 CoreFoundation 0x184045680 CFRunLoopRunSpecific + 384
20 UIKit 0x188ec2580 -[UIApplication _run] + 460
21 UIKit 0x188ebcd90 UIApplicationMain + 204
22 GSD_ZHIFUBAO 0x100091104 main (main.m:14)
23 libdyld.dylib 0x183be68b8 start + 4
Global Trace Buffer (reverse chronological seconds):
6148914688.454477 CFNetwork 0x000000018473984c TCP Conn 0x154739670 SSL Handshake DONE
6148914688.544633 CFNetwork 0x000000018473984c TCP Conn 0x154747a20 SSL Handshake DONE
6148914689.195506 CFNetwork 0x000000018473975c TCP Conn 0x154747a20 starting SSL negotiation
6148914689.195804 CFNetwork 0x00000001847db104 TCP Conn 0x154747a20 complete. fd: 16, err: 0
6148914689.196920 CFNetwork 0x00000001847dc630 TCP Conn 0x154747a20 event 1. err: 0
6148914689.222770 CFNetwork 0x000000018473975c TCP Conn 0x154739670 starting SSL negotiation
6148914689.223070 CFNetwork 0x00000001847db104 TCP Conn 0x154739670 complete. fd: 15, err: 0
6148914689.224137 CFNetwork 0x00000001847dc630 TCP Conn 0x154739670 event 1. err: 0
6148914689.516014 CFNetwork 0x00000001847dc708 TCP Conn 0x154747a20 started
6148914689.604255 CFNetwork 0x00000001847dc708 TCP Conn 0x154739670 started
6148914689.721041 CFNetwork 0x00000001847db104 TCP Conn 0x1545b1ad0 complete. fd: 6, err: 0
6148914689.721764 CFNetwork 0x00000001847dc630 TCP Conn 0x1545b1ad0 event 1. err: 0
6148914689.791580 CFNetwork 0x00000001847dc708 TCP Conn 0x1545b1ad0 started
6148914689.795240 CFNetwork 0x00000001848318bc Creating default cookie storage with default identifier
6148914689.795240 CFNetwork 0x0000000184831888 Faulting in CFHTTPCookieStorage singleton
6148914689.795291 CFNetwork 0x0000000184883558 Faulting in NSHTTPCookieStorage singleton
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000183d04140 __pthread_kill + 8
1 libsystem_pthread.dylib 0x0000000183dccef8 pthread_kill + 112
2 libsystem_c.dylib 0x0000000183c75dac abort + 140
3 libc++abi.dylib 0x00000001837a93f4 __cxa_bad_cast + 0
4 libc++abi.dylib 0x00000001837c2f60 std::__terminate(void (*)()) + 44
5 libc++abi.dylib 0x00000001837c285c __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*) + 0
6 libobjc.A.dylib 0x00000001837d0094 _objc_exception_destructor(void*) + 0
7 CoreFoundation 0x0000000184161848 -[NSException initWithCoder:] + 0
8 GSD_ZHIFUBAO 0x00000001004677d4 UmengSignalHandler + 144
9 libsystem_platform.dylib 0x0000000183dc593c _sigtramp + 52
10 Foundation 0x0000000184b0af40 ____addOperations_block_invoke + 328
11 Foundation 0x0000000184b08c84 __addOperations + 292
12 GSD_ZHIFUBAO 0x00000001000a5738 -[NetworkClient postPath:baseUrl:parameters:attachHeaders:isDelete:completion:failure:] (NetworkClient.m:288)
13 GSD_ZHIFUBAO 0x0000000100095b78 -[Netclient postUserinfo:failureBlock:] (Netclient.m:121)
14 GSD_ZHIFUBAO 0x00000001000427e0 -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:172)
15 UIKit 0x0000000188ec9704 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 400
16 UIKit 0x00000001890f8130 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2904
17 UIKit 0x00000001890fc4b8 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1672
18 UIKit 0x00000001890f95c0 -[UIApplication workspaceDidEndTransaction:] + 168
19 FrontBoardServices 0x0000000185717790 -[FBSSerialQueue _performNext] + 184
20 FrontBoardServices 0x0000000185717b10 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
21 CoreFoundation 0x0000000184118efc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
I think its trying to access deallocated memory.Exception subtype denotes it.
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000010
Just enable zombies object to track exact line of code which creates crash.
You can enable zombies by Go To Edit Scheme of project settings.
Please check below images to enable zombies.
I am facing a problem with reading crash logs in iOS. I updated the app then sent it to App store. Now I am getting crash reports. I want to fix these crashes but I couldn't read the log.
Where is the actual error message?
Here is the log:
Incident Identifier: B2A90B2D-931C-49CC-B357-21372248E0BC
CrashReporter Key: 634bf464908ebe6c51ac2ffd13270a80859ccf34
Hardware Model: xxx
Process: DronaWithStoryBoard [1023]
Path: /private/var/mobile/Containers/Bundle/Application/8FB555CC-32AE-465B-B1AB-AF3F5E31CAF4/DronaWithStoryBoard.app/DronaWithStoryBoard
Identifier: com.deltecs.DronaLite
Version: 3.0.0 (6.0.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2015-10-30 13:47:12.12 -0700
Launch Time: 2015-10-30 13:47:12.12 -0700
OS Version: iOS 9.1 (13B143)
Report Version: 105
Exception Type: EXC_CRASH (SIGSEGV)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Filtered syslog:
None found
Global Trace Buffer (reverse chronological seconds):
6148914687.966154 CFNetwork 0x0000000185235928 TCP Conn 0x14f762cc0 starting SSL negotiation
6148914687.966585 CFNetwork 0x0000000185235928 TCP Conn 0x14f648d80 starting SSL negotiation
6148914687.966619 CFNetwork 0x00000001852d7a30 TCP Conn 0x14f762cc0 complete. fd: 13, err: 0
6148914687.967027 CFNetwork 0x00000001852d7a30 TCP Conn 0x14f648d80 complete. fd: 7, err: 0
6148914687.968015 CFNetwork 0x00000001852d8f5c TCP Conn 0x14f762cc0 event 1. err: 0
6148914687.968440 CFNetwork 0x00000001852d8f5c TCP Conn 0x14f648d80 event 1. err: 0
6148914688.053584 CFNetwork 0x00000001852d9034 TCP Conn 0x14f762cc0 started
6148914688.053584 CFNetwork 0x00000001852d9034 TCP Conn 0x14f648d80 started
6148914688.055810 CFNetwork 0x000000018532e608 Creating default cookie storage with default identifier
6148914688.055810 CFNetwork 0x000000018532e5d4 Faulting in CFHTTPCookieStorage singleton
6148914688.055843 CFNetwork 0x0000000185380394 Faulting in NSHTTPCookieStorage singleton
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 CoreGraphics 0x0000000185de4620 0x185d88000 + 378400
1 CoreGraphics 0x0000000185d9c194 0x185d88000 + 82324
2 CoreGraphics 0x0000000185d9af28 0x185d88000 + 77608
3 CoreGraphics 0x0000000185d96d34 0x185d88000 + 60724
4 CoreGraphics 0x0000000185d94bd0 0x185d88000 + 52176
5 libRIP.A.dylib 0x0000000186101670 0x1860f8000 + 38512
6 libRIP.A.dylib 0x0000000186100a7c 0x1860f8000 + 35452
7 CoreGraphics 0x0000000185e2d08c 0x185d88000 + 675980
8 QuartzCore 0x000000018a90e0a8 0x18a8b4000 + 368808
9 QuartzCore 0x000000018a90d710 0x18a8b4000 + 366352
10 QuartzCore 0x000000018a90e6fc 0x18a8b4000 + 370428
11 QuartzCore 0x000000018a90d724 0x18a8b4000 + 366372
12 DronaWithStoryBoard 0x0000000100181618 0x10009c000 + 939544
13 DronaWithStoryBoard 0x0000000100181d2c 0x10009c000 + 941356
14 QuartzCore 0x000000018a8db4d8 0x18a8b4000 + 160984
15 QuartzCore 0x000000018a8bd944 0x18a8b4000 + 39236
16 QuartzCore 0x000000018a8bd630 0x18a8b4000 + 38448
17 QuartzCore 0x000000018a8bccc0 0x18a8b4000 + 36032
18 QuartzCore 0x000000018a8bca08 0x18a8b4000 + 35336
19 QuartzCore 0x000000018a8b60f8 0x18a8b4000 + 8440
20 CoreFoundation 0x0000000185aebbd0 0x185a10000 + 900048
21 CoreFoundation 0x0000000185ae9974 0x185a10000 + 891252
22 CoreFoundation 0x0000000185a18cc0 0x185a10000 + 36032
23 UIKit 0x000000018b1361c8 0x18b0b0000 + 549320
24 UIKit 0x000000018b130ffc 0x18b0b0000 + 528380
25 DronaWithStoryBoard 0x00000001000ac224 0x10009c000 + 66084
26 libdyld.dylib 0x000000019b1ca8b8 0x19b1c8000 + 10424
use crashlytics framework provided by twitter and supported by apple.... which will automatically generate detailed crash logs with exact problem at exact location in code. Best of luck
I Keep getting the following crash log in my new relic board. But I am not able to replicate the bug. The issue affects maybe more than half of the users. Has anyone else faced a similar issue or know how to fix it?
Hardware Model: iPhone 6 (iPhone7,2)
Process: T_APP [1421]
Code Type: arm64
Parent Process: launchd [1]
Date/Time: 2015-07-22 01:09:04 +0000
Launch Time: 2015-07-22 01:09:04 +0000
OS Version: iOS 8.1.2 (12B440)
Exception Type: SIGSEGV
Crashed Thread: 14
Application Specific Information:
*** Terminating app due to uncaught exception 'SIGSEGV', reason: ''
Thread 14 Crashed:
0 CFNetwork 0x187e41030 __ZN11HTTPMessage20ensureParserFinishedEv + 69680
1 CFNetwork 0x187e40fb8 __ZN11HTTPMessage19copyAllHeaderFieldsEPPK9__CFArray + 69560
2 CFNetwork 0x187e766d4 [NSHTTPURLResponse allHeaderFields] + 288468
3 T_App 0x10006b22c [NRMANSURLConnectionSupport noticeResponse:forRequest:withTimer:andBody:bytesSent:bytesReceived:] (NRMANSURLConnectionSupport.m:341)
4 T_App 0x100097fe0 [NRMANSURLConnectionDelegateBase connectionDidFinishLoading:] (NRMANSURLConnectionDelegateBase.m:126)
5 CFNetwork 0x187f8ae70 ___65-[NSURLConnectionInternal + 1420912
6 CFNetwork 0x187f8ae00 [NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 1420800
7 CFNetwork 0x187f8af7c [NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 1421180
8 CFNetwork 0x187f2c3f4 ____ZN27URLConnectionClient_Classic23_delegate_cacheTrifectaEPK20_CFCachedURLResponseU13block_pointerFvvE_block_invoke + 1033204
9 CFNetwork 0x187f28540 ____ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 1017152
10 CFNetwork 0x187e4bb54 __ZN19RunloopBlockContext13_invoke_blockEPKvPv + 113492
11 CoreFoundation 0x1883c8aac _CFArrayApplyFunction + 35500
12 CFNetwork 0x187e4ba00 __ZN19RunloopBlockContext7performEv + 113152
13 CFNetwork 0x187e4b8b4 __ZN17MultiplexerSource7performEv + 112820
14 CFNetwork 0x187e4b6e0 __ZN17MultiplexerSource8_performEPv + 112352
15 CoreFoundation 0x18849e9ec ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 911852
16 CoreFoundation 0x18849dc90 ___CFRunLoopDoSources0 + 908432
17 CoreFoundation 0x18849bd40 ___CFRunLoopRun + 900416
18 CoreFoundation 0x1883c90a4 _CFRunLoopRunSpecific + 37028
19 WebCore 0x195f50674 __ZN7WebCoreL15runLoaderThreadEPv + 935540
20 JavaScriptCore 0x189950b80 __ZN3WTFL19wtfThreadEntryPointEPv + 84864
21 libsystem_pthread.dylib 0x19945fe80 __pthread_body + 16000
22 libsystem_pthread.dylib 0x19945fddc __pthread_body + 15836
23 libsystem_pthread.dylib 0x19945cfb0 _thread_start + 4016