Tôi nhận Use of undeclared identifier
cho mọi đối tượng Facebook tôi sử dụngFacebook SDK Swift - Sử dụng định danh chưa được khai báo
Tiếp theo hướng dẫn này: TUTORIAL: HOW TO SHARE IN FACEBOOK SDK 4.1.X FOR SWIFT
Nhưng tôi đã có những lỗi sau:
Tôi đã thêm khuôn khổ Facebook qua cocoapods:
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
Và nó đã được cài đặt thành công
Tôi đã thêm cầu nối tiêu đề
#ifndef Bridging_Header_h
#define Bridging_Header_h
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
#endif /* Bridging_Header_h */
Phần header bắc cầu được kết nối:
.210Tôi đã cấu hình plist tôi
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb*****</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>*****</string>
<key>FacebookDisplayName</key>
<string>*****</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
</dict>
</dict>
</dict>
Đây là mã:
let content : FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: "<INSERT STRING HERE>")
content.contentTitle = "<INSERT STRING HERE>"
content.contentDescription = "<INSERT STRING HERE>"
content.imageURL = NSURL(string: "<INSERT STRING HERE>")
let button : FBSDKShareButton = FBSDKShareButton()
button.shareContent = content
button.frame = CGRectMake((UIScreen.mainScreen().bounds.width - 100) * 0.5, 50, 100, 25)
self.view.addSubview(button)
bạn đã chạy pod install hoặc thử chạy lại lần nữa –
@OmkarGuhilot Tôi đã làm. Nó hoạt động tốt. Các khung công tác này nằm trong dự án Pods của tôi – Luda
Vì vậy, nó được giải quyết và nó đã giải quyết bằng cách chạy pod cài đặt một lần nữa? –