Add custom fields to crash report

Marta Klein November 28, 2011

Hi there,

I added JMC to my iPhone App and tried to add custom-fields to my crash reports. I change the fields 'summary' and 'description' and that works fine for me. But adding custom-fields doesn't.

Unfortunately, the delegate method - (NSDictionary *)customFields only called when sending feedback... not when sending a crash report.

I also tried to add custom field data to the function (see JMCClasses/Core/transport/JMCCrashTransport.m)

- (void)send:(NSString *)subject description:(NSString *)description crashReport:(NSString *)crashReport

{

...

NSDictionary* dictCustomFields = [[JMC instance] getBugCustomFields];

NSData *customFieldsJSON =

[[dictCustomFields JSONRepresentation] dataUsingEncoding:NSUTF8StringEncoding];

JMCAttachmentItem *customFieldsItem =

[[JMCAttachmentItemalloc] initWithName:@"customfields"

data:customFieldsJSON

type:JMCAttachmentTypeCustom

contentType:@"application/json"

filenameFormat:@"customfields.json"];

NSArray *attachments = [NSArray arrayWithObjects:crashData, customFieldsItem, nil];

[customFieldsItem release];

JMCQueueItem *item =

[self qeueItemWith:description

attachments:attachments

params:params

issueKey:nil];

[[JMCRequestQueuesharedInstance] addItem:item];

}

My custom-field key/value paire looks like this:

[customFields setObject:@"3"forKey:@"affects_build_number"];

[customFields setObject:@"iOS 5.0.1"forKey:@"os_version"];

where 'os_version' is a drop-down in JIRA. But that doesn't work, either.

Would be perfect if someone can help me :)

Best

mKlein

4 answers

0 votes
Nick
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 29, 2011

Hi mKlein,

Good catch with the issueType. I just pushed a fix for it. Please let me know how you go.

Regarding the version numbers not getting correctly set, this is definitely working for our hosted instance e.g. http://connect.onjira.com/browse/NERDS-32526

Both "Bundle Version" and "Bundle versions string, short" from the App's Info.plist are getting set to the affectsVersion. NB: an affects version with the exact name must exist.

You may have an old version of the jira plugin, there was an improvement done recently to ensure both versions are set.

Version 1.0.9 is the latest release https://plugins.atlassian.com/plugin/details/322837 .

Cheeers,

NIck

Marta Klein November 29, 2011

Ok, thanks... works again :)

But I still don't get the Version numer to work... and I have the latest plugin installed (1.0.9).

What what is the "exact name" in the affects version field? Can you please give me an example here? When I enter 'version number comma build number' it doesn't work.

Cheers,

m

0 votes
Marta Klein November 29, 2011

Hi Nick,

thanks for you fast reply. And the fast fix :)

I'm hosting my own JIRA instance.

And I also tried to get the Version AND Build number into the 'affects version' field (as it is in you Angry Nerds example). Therefore I use Version '1.0.0' and Build '1' in Xcode. In my JIRA instance, I added '1.0.0, 1' and '1.0.0' as versions. But it always shows '1.0.0' without the build number.

Do I have to use a different format in JIRA? Did I forgot a setting in JMC?

Best

mKlein

Edit:

I found out, that all Bugs and Feedbacks gets send as 'Improvement'. See following method in JMCTransport.m :

- (NSMutableDictionary*)buildCommonParams:(NSString*)subject defaultType:(NSString *)type

{

...

NSString *typeName = [[JMCinstance] issueTypeNameFor:JMCIssueTypeFeedbackuseDefault:type];

...

0 votes
Nick
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 29, 2011

Ok - CONNECT-116 is fixed and pushed to default on the bitbucket repo.

In testing that, I noticed that there may be an issue with multi-valued custom fields, so have raised https://connect.onjira.com/browse/CONNECT-117 .

This fix will need to be made in the JIRA Plugin.

Are you hosting your own JIRA instance, or using an OnDemand instance ?

0 votes
Nick
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 29, 2011

Hi mKlein,

You've uncovered a slight inconsistency there. I have created CONNECT-116 to track this, and hope to push a fix for it soon.

Note however that the if you have the build number set as a version in JIRA, it will get set automatically for you.

And the OS Version is also automatically set on the both the environment field, and as a label.

I will let you know when I have pushed CONNECT-116.

Cheers,

Nick

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events