Skip to content

Commit

Permalink
Fix FBSDKLoginButton nonce property attributes (#1616)
Browse files Browse the repository at this point in the history
Summary:
Thanks for proposing a pull request!

To help us review the request, please complete the following:

- [x] sign [contributor license agreement](https://developers.facebook.com/opensource/cla)
- [x] I've ensured that all existing tests pass and added tests (when/where necessary)
- [x] I've updated the documentation (when/where necessary) and [Changelog](CHANGELOG.md) (when/where necessary)
- [x] I've added the proper label to this pull request (e.g. `bug` for bug fixes)

## Pull Request Details

The attributes for the `nonce` property of the `FBSDKLoginButton` are incorrect and lead to build errors.

In scenarios where the [`objc-property-assign-on-object-type`](https://clang.llvm.org/docs/DiagnosticsReference.html#wobjc-property-assign-on-object-type) flag is enabled and warnings are treated as errors, the build fails with: `FBSDKLoginKit.framework/Headers/FBSDKLoginButton.h:109:1: 'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'`

Pull Request resolved: #1616

Reviewed By: jingping2015

Differential Revision: D26002203

Pulled By: ppansy

fbshipit-source-id: 5101f92f8f79b069f63b022129f70ad7becdb4e3
  • Loading branch information
kmcbride authored and facebook-github-bot committed Jan 22, 2021
1 parent 0403812 commit 9ce4507
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ NS_SWIFT_NAME(FBLoginButton)
Gets or sets an optional nonce to use for login attempts. A valid nonce must be a non-empty string without whitespace.
An invalid nonce will not be set. Instead, default unique nonces will be used for login attempts.
*/
@property (assign, nonatomic, nullable) NSString *nonce;
@property (copy, nonatomic, nullable) NSString *nonce;

@end

Expand Down
2 changes: 1 addition & 1 deletion FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ - (UIFont *)defaultFont
- (void)setNonce:(NSString *)nonce
{
if ([FBSDKNonceUtility isValidNonce:nonce]) {
_nonce = nonce;
_nonce = [nonce copy];
} else {
_nonce = nil;
[FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors
Expand Down
2 changes: 1 addition & 1 deletion FBSDKLoginKit/FBSDKLoginKitTests/LoginButtonTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import XCTest

class LoginButtonTests: XCTestCase {

let validNonce: NSString = "abc123"
let validNonce: String = "abc123"
var button: FBLoginButton! // swiftlint:disable:this force_unwrapping
var sampleProfile: Profile {
return Profile(
Expand Down

0 comments on commit 9ce4507

Please sign in to comment.