Objective c ';n内部一致性异常';错误';MVFloatingButton';

Objective c ';n内部一致性异常';错误';MVFloatingButton';,objective-c,memory-management,tableview,dealloc,Objective C,Memory Management,Tableview,Dealloc,我已经在网上做了很多关于这个问题的搜索,但是我还没有解决它,所以我不得不把这个问题贴出来 我在应用程序中使用浮动按钮;我已经通过Cocoapods将图书馆包含在我的pod文件中。Pod库是“MVFloatingButton”。在我添加浮动按钮之前,这个应用程序运行得非常好 请在TableView上找到浮动按钮的屏幕截图(在iOS模拟器中运行) 我的问题与我的TableView有关。浮动按钮在tableView上显示良好,但当我导航回主屏幕时,我的应用程序崩溃,出现以下错误: *由于未捕获的异常

我已经在网上做了很多关于这个问题的搜索,但是我还没有解决它,所以我不得不把这个问题贴出来

我在应用程序中使用浮动按钮;我已经通过Cocoapods将图书馆包含在我的pod文件中。Pod库是“MVFloatingButton”。在我添加浮动按钮之前,这个应用程序运行得非常好

请在TableView上找到浮动按钮的屏幕截图(在iOS模拟器中运行)

我的问题与我的TableView有关。浮动按钮在tableView上显示良好,但当我导航回主屏幕时,我的应用程序崩溃,出现以下错误:

*由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因是:“UITableView类的一个实例0x7a8a5000已解除分配,而键值观察员仍在向其注册。当前观测信息:( 上下文:0x0,属性:0x79f91d10> 上下文:0x0,属性:0x79f92bf0> 上下文:0x0,属性:0x79f93000> )' *第一次抛出调用堆栈: ( 0 CoreFoundation 0x036a1494例外预处理+180 1 libobjc.A.dylib 0x0315be02 objc_异常_抛出+50 2 CoreFoundation 0x036a13bd+[N异常提升:格式:][141 3基金会0x02D94097 NSKOVDROBIT + 353 4 UIKit 0x020cf348-[UIView(UIKitManual)版本]+142 5 libobjc.A.dylib 0x0316e34f objc_版本+47 6 libobjc.A.dylib 0x0316f52d\u ZN12\u全局\u N\u 119AutoreleasePoolPage3Opepv+371 7 CoreFoundation 0x035718a8自动释放池POP+24 8 CoreFoundation 0x035a943c _ucfrunlooprun+2364 9 CoreFoundation 0x035a8846 CFRunLoopRunSpecific+470 10 CoreFoundation 0x035a865b CFRUNLOOPSRUNINMODE+123 11图形服务0x0662a664 GSEventRunModal+192 12图形服务0x0662a4a1 GSEventRun+104 13 UIKit 0x017dfeb9 UIApplicationMain+160 14 NHSF 0x00096afa干管+138 15 libdyld.dylib 0x04865a25启动+1 ) libc++abi.dylib:以NSException类型的未捕获异常终止

这是my.m文件的代码:

#import "NHSFAdminTeamTableViewController.h"
#import "Admin.h"
#import "UIScrollView+FloatingButton.h"

#define getURLData @"http://dbchudasama.webfactional.com/jsonscriptAdmin.php"

static NSString *CellIdentifier = @"Cell";


@interface NHSFAdminTeamTableViewController () <MEVFloatingButtonDelegate>

@end

@implementation NHSFAdminTeamTableViewController

@synthesize jsonArray, AdminArray;


- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    //Load data
    [self retrieveData];

    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;

    //v3.0 -- Initialising Floating Button
    MEVFloatingButton *button = [[MEVFloatingButton alloc] init];
    button.animationType = MEVFloatingButtonAnimationNone;
    button.displayMode = MEVFloatingButtonDisplayModeAlways;
    button.position = MEVFloatingButtonPositionBottomRight;
    button.image = [UIImage imageNamed:@"ic_create_white_24dp"];
    //button.imageColor = [UIColor groupTableViewBackgroundColor];
    button.backgroundColor = [UIColor orangeColor];
    button.outlineColor = [UIColor blackColor];
    button.outlineWidth = 0.0f;
    button.imagePadding = 15.0f;
    button.horizontalOffset = -22.0f;
    button.verticalOffset = -70.0f;
    button.shadowColor = [UIColor blackColor];
    button.shadowOffset = CGSizeMake(3, 3);
    button.shadowOpacity = 0.6f;
    button.shadowRadius = 3.0f;
    button.rounded = YES;
    button.hideWhenScrollToTop = NO;

    [self.tableView setFloatingButtonView:button];
    [self.tableView setFloatingButtonDelegate:self];
    //v3.0 --
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{

    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    //Setting row selection to no for entire table so user can't select an rows. READ ONLY!
    tableView.allowsSelection = NO;

    // Return the number of rows in the section.
    return [self.AdminArray count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];


    // Configure the cell...
    Admin *idObject;

    //Grab the current object in indexPath and set it to Team Coordinator object
    idObject = [AdminArray objectAtIndex:indexPath.row];

    cell.textLabel.text = idObject.AdminRole;
    cell.detailTextLabel.text = idObject.Name;

    //Accessory
    //cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    return cell;
}


/*
 // Override to support conditional editing of the table view.
 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
 {
 // Return NO if you do not want the specified item to be editable.
 return YES;
 }
 */

/*
 // Override to support editing the table view.
 - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
 {
 if (editingStyle == UITableViewCellEditingStyleDelete) {
 // Delete the row from the data source
 [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
 } else if (editingStyle == UITableViewCellEditingStyleInsert) {
 // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
 }
 }
 */

/*
 // Override to support rearranging the table view.
 - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
 {
 }
 */

/*
 // Override to support conditional rearranging of the table view.
 - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
 {
 // Return NO if you do not want the item to be re-orderable.
 return YES;
 }
 */

/*
 #pragma mark - Navigation
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
 {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */


//Method to retrieve data from database
-(void)retrieveData
{
    //Passing in the URL of the database
    NSURL *url = [NSURL URLWithString:getURLData];

    //Creating object of the database data
    NSData *data = [NSData dataWithContentsOfURL:url];

    jsonArray = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];

    //Set up the TC array
    AdminArray = [[NSMutableArray alloc] init];

    //Loop through the jsonArray
    for (int i=0; i < jsonArray.count; i++) {

        //Create the Team Coordinator object
        //NSString *eID = [[jsonArray objectAtIndex:i] objectForKey:@"id"];
        NSString *aRole = [[jsonArray objectAtIndex:i] objectForKey:@"AdminRole"];
        NSString *aName = [[jsonArray objectAtIndex:i] objectForKey:@"Name"];
        //NSString *eTime = [[jsonArray objectAtIndex:i] objectForKey:@"eventTime"];
        //NSString *eLocation = [[jsonArray objectAtIndex:i] objectForKey:@"eventLocation"];

        //Now, add the Team Coordinator object to our TC array
        [AdminArray addObject:[[Admin alloc] initWithAdminTeam:aRole andName:aName]];
    }

    //Reload the table data
    [self.tableView reloadData];
}

//v3.0 -- Delegate Methods for Floating Button 
#pragma mark - MEScrollToTopDelegate Methods

- (void)floatingButton:(UIScrollView *)scrollView didTapButton:(UIButton *)button {
    NSLog(@"didTapButton");
    //[self.tableView setContentOffset:CGPointMake(0, -self.tableView.contentInset.top) animated:YES];
}

- (void)floatingButtonWillAppear:(UIScrollView *)scrollView {
    NSLog(@"floatingButtonWillAppear");
}

- (void)floatingButtonDidAppear:(UIScrollView *)scrollView {
    NSLog(@"floatingButtonDidAppear");
}

- (void)floatingButtonWillDisappear:(UIScrollView *)scrollView {
    NSLog(@"floatingButtonWillDisappear");
}

- (void)floatingButtonDidDisappear:(UIScrollView *)scrollView; {
    NSLog(@"floatingButtonDidDisappear");
}
//v3.0 --

@end
#导入“NHSFAdminTeamTableViewController.h”
#导入“Admin.h”
#导入“UIScrollView+FloatingButton.h”
#定义getURLData@“http://dbchudasama.webfactional.com/jsonscriptAdmin.php"
静态NSString*CellIdentifier=@“Cell”;
@接口NHSFAdminTeamTableViewController()
@结束
@实现NHSFAdminTeamTableViewController
@合成jsonArray、AdminArray;
-(id)initWithStyle:(UITableViewStyle)样式
{
self=[super initWithStyle:style];
如果(自我){
//自定义初始化
}
回归自我;
}
-(无效)viewDidLoad
{
[超级视图下载];
//加载数据
[自检索数据];
//取消对下一行的注释以保留演示文稿之间的选择。
//self.clearselectiononviewwillappear=否;
//取消对以下行的注释,以在此视图控制器的导航栏中显示编辑按钮。
//self.navigationItem.rightBarButtonItem=self.editButtonItem;
//v3.0——初始化浮动按钮
MEVFloatingButton*按钮=[[MEVFloatingButton alloc]init];
button.animationType=MEVFloatingButtonAnimationNone;
button.displayMode=MEVFloatingButtonDisplayModeAlways;
button.position=MEVFloatingButton位置右下角;
button.image=[UIImage ImageName:@“ic_创建_白色_24dp”];
//button.imageColor=[UIColor groupTableViewBackgroundColor];
button.backgroundColor=[UIColor orangeColor];
button.outlineColor=[UIColor blackColor];
button.outlineWidth=0.0f;
button.imagePadding=15.0f;
button.horizontalOffset=-22.0f;
垂直偏移=-70.0f;
button.shadowColor=[UIColor blackColor];
button.shadowOffset=CGSizeMake(3,3);
button.shadowOpacity=0.6f;
button.shadowRadius=3.0f;
button.rounded=是;
button.hideWhenScrollToTop=否;
[self.tableView设置浮动按钮视图:按钮];
[self.tableView setfloatingbuttonedelegate:self];
//v3.0--
}
-(无效)未收到记忆警告
{
[超级记忆警告];
//处置所有可以重新创建的资源。
}
#pragma标记-表视图数据源
-(NSInteger)表格视图中的节数:(UITableView*)表格视图
{
//返回节数。
返回1;
}
-(NSInteger)表视图:(UITableView*)表视图行数节:(NSInteger)节
{
//将整个表的行选择设置为“否”,以便用户无法选择行。只读!
tableView.AllowSelection=否;
//返回节中的行数。
返回[self.AdminArray count];
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
UITableViewCell*单元格=[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
//配置单元格。。。
管理员*idObject;
//在indexPath中获取当前对象并将其设置为Team Coordinator对象
idObject=[AdminArray objectAtIndex:indexPath.row];
cell.textlab.text=idObject.AdminRole;
cell.detailTextLabel.text=idObject.Name;
//附属品
//cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
返回单元;
}
/*
//替代以支持表视图的条件编辑。
-(BOOL)tableView:(UITableView*)tableView caneditrowatinexpath:(nsindepath*)indepath
{
//如果不希望指定的项可编辑,则返回“否”。
返回YES;
}
*/
/*
//替代以支持编辑表格视图。
-(void)tableView:(用户界面)
#import <UIKit/UIKit.h>

@interface NHSFAdminTeamTableViewController : UITableViewController

@property (strong, nonatomic) NSMutableArray *jsonArray;
@property (strong, nonatomic) NSMutableArray *AdminArray;


#pragma mark - Class Method
-(void)retrieveData;


//v3,0 -- Delegate Method Constructors for Floating Button
#pragma mark - MEScrollToTopDelegate Methods

- (void)floatingButton:(UIScrollView *)scrollView didTapButton:(UIButton *)button;
- (void)floatingButtonWillAppear:(UIScrollView *)scrollView;
- (void)floatingButtonDidAppear:(UIScrollView *)scrollView;
- (void)floatingButtonWillDisappear:(UIScrollView *)scrollView;
- (void)floatingButtonDidDisappear:(UIScrollView *)scrollView;
//3.0 --

@end