作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
大家好,遇到重大错误时我被告知 SLComposerViewController 无法识别。 UIController 没有可见的接口(interface),如果正确编写,我的 else 语句中没有预期的标识符。它也无法识别我的 actionContoller 或我的 twitterVC。我在学校,这是我得到的代码示例,我已经检查过它并对其进行了三次检查,它是逐字写在指令示例中的,这让我感到困惑,因为总共有 12 个错误。任何人都可以给我纠正这些错误的任何帮助都会很棒!
// ViewController.m
// SocialNetworkApp
//
// Created by Jessy on 2/12/18.
// Copyright © 2018 A3LeversPeer. All rights reserved.
//
#import "ViewController.h"
#import "Social/Social.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextView *tweetTextView;
- (void) configureTweetTextView;
- (void) showAlertMessage: (NSString *) myMessage;
@property (weak, nonatomic) IBOutlet UITextView *fbTextView;
@property (weak, nonatomic) IBOutlet UITextView *socialTextView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self configureTweetTextView];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void) showAlertMessage:(NSString *) myMessage {
UIAlertController *alertController;
alertController = [UIAlertController alertControllerWithTitle:@"TwitterShare" message:myMessage preferredStyle: UIAlertControllerStyleAlert];
[alertController addAction: [UIAlertAction actionWithTitle:@"Okay" style:UIAlertActionStyleDefault handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
}
- (IBAction)tweetShareAction:(id)sender {
if ([self.tweetTextView isFirstResponder]) {
[self.tweetTextView resignFirstResponder];
}
UIAlertController *actionController = [UIAlertController alertControllerWithTitle:@"" message:@"Tweet Notes" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction =[UIAlertAction actionWithTitle:@"Cancel" style: UIAlertActionStyleDefault handler:nil];
UIAlertAction *tweetAction =[UIAlertAction actionWithTitle:@"Tweet"style: UIAlertActionStyleDefault handler:
^(UIAlertAction *action) {
if([SLComposeViewController
isAvailableForServiceType:SLServiceTypeTwitter]
(SLComposeViewController *twitterVC= [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter]);
}];
//Tweet Out
if( [self.tweetTextView.text length] <140 ) {
[twitterVC setInitialText:self.tweetTextView.text];
}
else{
NSString *shortText = [self.tweetTextView.text substringToIndex:140];
}
[self.presentedViewController: twitterVC animated:YES completion:nil];
}
else{
//Raise Objection
[self showAlertMessage:@"Sign in to Twitter"];
[actionController addAction:tweetAction];
[actionController addAction:cancelAction];
[self presentViewController:actionController animated:YES completion:nil];
- (void) configureTweetTextView {
self.tweetTextView.layer.backgroundColor =[UIColor colorWithRed: 0.98
green: 0.80 blue: 0.93
alpha: 1.0].CGColor;
self.tweetTextView.layer.cornerRadius= 10.0;
self.tweetTextView.layer.borderColor= [UIColor colorWithWhite: 0
alpha: 0.5].CGColor;
self.tweetTextView.layer.borderWidth= 2.0;
}
- (IBAction)fbShareAction:(id)sender {
}
- (IBAction)socialShareAction:(id)sender {
}
- (IBAction)nothingShareAction:(id)sender {
}
@end
最佳答案
尝试替换:
#import "Social/Social.h"
通过:
#import <Social/Social.h>
Social 是 Apple 的框架,所以你应该用 <>
导入它。签名。
顺便检查一下你的Target -> General -> Linked Frameworks and Libraries
您包含在 Social.framework 中。
关于ios - 意外的标识符 SLComposerView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48886911/
大家好,遇到重大错误时我被告知 SLComposerViewController 无法识别。 UIController 没有可见的接口(interface),如果正确编写,我的 else 语句中没有预
我是一名优秀的程序员,十分优秀!