If you take a look at UIView.h or UIView documentation UIView layoutMargings property, you may notice that this property is only available for iOS 8 and above.
Once you are running your application on iPhone 4 and it is not intended to support this version of iOS (iOS 8)iPhone 4 versions of iOS supported, you should perform validations on your code to check if the API method is available. You can also check the version of iOS, it's your choice.
I don't know your implementation, but as a quick fix you can check if the instance of the cell responds to the selector, and perform the correct implementation.
Example:
UITableViewCell *tableViewCell = [[UITableViewCell alloc] init];
if ([tableViewCell respondsToSelector:@selector(setLayoutMargins:)]) {
<# Your code here #>
}
To check the iOS version, you should use a macro or a function, just to keep your code simple. Just check here for more questions about: How to check iOS version? or check github repo carlj/CJAMacros
Hope that can help ;)