在iTunes上传后,按钮不再起作用

时间:2015-12-09 09:56:31

标签: ios itunesconnect

当我在iphone上安装它时,我有一个正常工作的应用程序,但问题是我在iTunes上传应用程序后,我在应用程序中最喜欢的按钮不再工作了。

知道什么是错的,或者是否有可能为构建提交调试?

- (IBAction)fav:(id)sender {

    NSMutableArray *fav;
    NSMutableArray *imgFav;
    NSMutableArray *urlFav;

    BOOL alreadyInFav=NO;


    fav = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"radioName"]mutableCopy];
    imgFav = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"imgFav"]mutableCopy];
    urlFav = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"urlFav"]mutableCopy];

    for (int i=0; i<fav.count; i++) {
        if ([fav[i] isEqualToString:name[indexCell]]) {
            alreadyInFav=YES;
        }
    }


    if (alreadyInFav==NO) {

    if (fav) {

        NSString *nameCell=name[indexCell];
        [fav addObject:nameCell];
        NSString *imgCell=img[indexCell];
        [imgFav addObject:imgCell];
        NSString *urlCell=url[indexCell];
        [urlFav addObject:urlCell];
    }
    else
    {

        fav=[[NSMutableArray alloc]init];
        imgFav=[[NSMutableArray alloc]init];
        urlFav=[[NSMutableArray alloc]init];


        NSString *nameCell=name[indexCell];
        [fav addObject:nameCell];
        NSString *imgCell=img[indexCell];
        [imgFav addObject:imgCell];
        NSString *urlCell=url[indexCell];
        [urlFav addObject:urlCell];
    }



    self.facImg.image=[UIImage imageNamed:@"fav_on.png"];

    [[NSUserDefaults standardUserDefaults] setObject:fav forKey:@"radioName"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    favorite = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"radioName"]mutableCopy];

    [[NSUserDefaults standardUserDefaults] setObject:imgFav forKey:@"imgFav"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    imgFavorite = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"imgFav"]mutableCopy];

    [[NSUserDefaults standardUserDefaults] setObject:urlFav forKey:@"urlFav"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    urlFavorite = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"urlFav"]mutableCopy];

    }



    else{


        favorite = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"radioName"]mutableCopy];
        imgFavorite = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"imgFav"]mutableCopy];
        urlFavorite = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"urlFav"]mutableCopy];
        NSString *urlCell;
        NSString *nameCell;
        NSString *imgCell;



        if (!fromFav) {

        urlCell=url[indexCell];
        nameCell=name[indexCell];
        imgCell=img[indexCell];


            [favorite removeObject:nameCell];
            [imgFavorite removeObject:imgCell];
            [urlFavorite removeObject:urlCell];}

        else{
            urlCell=url[cellColl];
            nameCell=name[cellColl];
            imgCell=img[cellColl];


            [favorite removeObjectAtIndex:cellColl];
            [imgFavorite removeObjectAtIndex:cellColl];
            [urlFavorite removeObjectAtIndex:cellColl];
        }




        [[NSUserDefaults standardUserDefaults] setObject:urlFavorite forKey:@"urlFav"];
        [[NSUserDefaults standardUserDefaults] synchronize];

        [[NSUserDefaults standardUserDefaults] setObject:imgFavorite forKey:@"imgFav"];
        [[NSUserDefaults standardUserDefaults] synchronize];

        [[NSUserDefaults standardUserDefaults] setObject:favorite forKey:@"radioName"];
        [[NSUserDefaults standardUserDefaults] synchronize];

        favorite = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"radioName"]mutableCopy];
        imgFavorite = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"imgFav"]mutableCopy];
        urlFavorite = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"urlFav"]mutableCopy];


        self.facImg.image=[UIImage imageNamed:@"favorite@3x.png"];





    }


    [self.collection reloadData];


}

0 个答案:

没有答案