Skip to content

Commit

Permalink
Add support for iOS7 plist crash file
Browse files Browse the repository at this point in the history
  • Loading branch information
zqqf16 committed Mar 14, 2017
1 parent 642695a commit 57c2ea2
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
4 changes: 4 additions & 0 deletions SYM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
511F80721E77A14000C69C43 /* PlistDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = 511F80711E77A14000C69C43 /* PlistDocument.swift */; };
513D6ABC1E2394F8008755EE /* CrashFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 513D6ABB1E2394F8008755EE /* CrashFile.swift */; };
514B4F6B1E30AC9100171990 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 514B4F6A1E30AC9100171990 /* Foundation.framework */; };
5157C7BC1E2E2D200035DFDE /* ThreadBottomBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5157C7BB1E2E2D200035DFDE /* ThreadBottomBar.swift */; };
Expand Down Expand Up @@ -55,6 +56,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
511F80711E77A14000C69C43 /* PlistDocument.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlistDocument.swift; sourceTree = "<group>"; };
513D6ABB1E2394F8008755EE /* CrashFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrashFile.swift; sourceTree = "<group>"; };
514B4F6A1E30AC9100171990 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
5157C7BB1E2E2D200035DFDE /* ThreadBottomBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThreadBottomBar.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -145,6 +147,7 @@
children = (
513D6ABB1E2394F8008755EE /* CrashFile.swift */,
51B8D7041D4F620100F2C24C /* CrashDocument.swift */,
511F80711E77A14000C69C43 /* PlistDocument.swift */,
F4A679731E21319D009F93E7 /* BundleDocument.swift */,
);
name = Document;
Expand Down Expand Up @@ -371,6 +374,7 @@
buildActionMask = 2147483647;
files = (
5157C7BE1E2F7F150035DFDE /* CrashInfoViewController.swift in Sources */,
511F80721E77A14000C69C43 /* PlistDocument.swift in Sources */,
F40A36A41D3FBB7200F3B00C /* Regex.swift in Sources */,
513D6ABC1E2394F8008755EE /* CrashFile.swift in Sources */,
5157C7BC1E2E2D200035DFDE /* ThreadBottomBar.swift in Sources */,
Expand Down
18 changes: 17 additions & 1 deletion SYM/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@
<key>NSDocumentClass</key>
<string>$(PRODUCT_MODULE_NAME).CrashDocument</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>plist</string>
</array>
<key>CFBundleTypeName</key>
<string>Property List</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>com.apple.property-list</string>
</array>
<key>NSDocumentClass</key>
<string>$(PRODUCT_MODULE_NAME).PlistDocument</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
Expand All @@ -61,7 +77,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>24</string>
<string>25</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
40 changes: 40 additions & 0 deletions SYM/PlistDocument.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// The MIT License (MIT)
//
// Copyright (c) 2016 zqqf16
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.


import Foundation

class PlistDocument: CrashDocument {
override func read(from data: Data, ofType typeName: String) throws {
guard let plist = try? PropertyListSerialization.propertyList(from: data, options: [], format: nil) as? [String: AnyObject] else {
return
}

guard let content = plist?["description"] as? String,
let data = content.data(using: .utf8)
else {
return
}

try? super.read(from: data, ofType: typeName)
}
}

0 comments on commit 57c2ea2

Please sign in to comment.