How can I check to see if an NSString contains base64 data in an if statement? Because base64 encodes the data in a completely random way, I can't search for a phrase within the NSString so instead I will need to check to see if the contents of the string results in a data file.
相关问题
- Views base64 encoded blob in HTML with PHP
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
Here's a category on
NSString
I created that should work:If you expect newlines or blank spaces in the data, you could update this method to remove those first (likely
NSCharacterSet
's+whitespaceCharacterSet
).If there's primarily just one class where you'll be using this category method, you could put this code inside its .m file above that class's
@implementation
block. If you think you might want to use that category from more than one class, you could create a separate .h & .m pair to contain it (e.g.MDFoundationAdditions.h
,MDFoundationAdditions.m
), and then import it into those classes.To use: