Category: iOS 開發 Q&A

[iOS]How to trace crash log with symbolicatecrash

1
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash crash.log MyApp.app.dSYM > symbol_crash.log
Tags :

[Q&A] Error Itms-90339: This bundle is invalid . The info.plist contains an invalid key ‘CFBundleResourceSpecification’ in app bundle

1. remove

1
CODE_SIGN_RESOURCE_RULES_PATH=$(SDKROOT)/ResourceRules.plist

2. modify

1
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication

change

1
2
3
my @codesign_args = ("/usr/bin/codesign", "--force", "--preserve-metadata=identifier,entitlements,resource-rules",
                  "--sign", $opt{sign},
                  "--resource-rules=$destApp/ResourceRules.plist");

to

1
2
my @codesign_args = ("/usr/bin/codesign", "--force", "--preserve-metadata=identifier,entitlements",
                  "--sign", $opt{sign});

3. change file permission

1
sudo chown myuser /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/ResourceRules.plist
Tags :

[Q&A] How to enable silent notification in iOS

set content-available = 1

Provide this key with a value of 1 to indicate that new content is available. Including this key and value means that when your app is launched in the background or resumed,application:didReceiveRemoteNotification:fetchCompletionHandler: is called.

(Newsstand apps are guaranteed to be able to receive at least one push with this key per 24-hour window.)

Tags : ,

[QA]How to sort NSArray in 3 ways

Compare method

1
2
3
4
5
6
- (NSComparisonResult)compare:(Person *)otherObject {
    return [self.birthDate compare:otherObject.birthDate];
}
 
NSArray *sortedArray;
sortedArray = [drinkDetails sortedArrayUsingSelector:@selector(compare:)];

NSSortDescriptor

1
2
3
4
5
6
NSSortDescriptor *sortDescriptor;
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"birthDate"
                                              ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
NSArray *sortedArray;
sortedArray = [drinkDetails sortedArrayUsingDescriptors:sortDescriptors];

Blocks

1
2
3
4
5
6
NSArray *sortedArray;
sortedArray = [drinkDetails sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
    NSDate *first = [(Person*)a birthDate];
    NSDate *second = [(Person*)b birthDate];
    return [first compare:second];
}];
Tags : ,

[QA] Undefined symbols using CocoaPods

Sorry, this entry is only available in 中文.

Tags :

[QA] iOS property attributes

Tags :

[QA] How to center the content in UIWebView

Sorry, this entry is only available in 中文.

Tags : ,

[QA] How to chnage iOS left navigationBar title

Read more

Tags : ,

如何使用 #ifdef 判斷 arch

#ifdef TARGET_IPHONE_SIMULATOR

#ifdef TARGET_OS_IPHONE

Tags :

[QA] How to enable c++11 for android and ios

Sorry, this entry is only available in 中文.

Tags : ,