How to fix "/etc/apt/sources.list" could not be read error?

755

You have appended the second command to the sources.list with tee. Edit your sources.list with sudo nano /etc/apt/sources.list. Remove the sudo ... line (you should find it at the end) save and exit Ctrl+O, Ctrl+X.

Then update your sources with sudo apt-get update and you should be fine again.

If you delete the sources.list while editing ths sources.list.Open the terminal ctrl+alt+T and become root by typing sudo -s and cd /etc/apt and then check the file sources.list.distUpgrade then type cp sources.list.distUpgrade sources.list that's all.

Then update your sources with sudo apt-get update and it should be fixed.

Share:
755

Related videos on Youtube

Eliran Efron
Author by

Eliran Efron

Updated on September 18, 2022

Comments

  • Eliran Efron
    Eliran Efron over 1 year

    I am building an app that has a navigationitem in the navigation bar.

    I am trying to understand how to use the facebook sdk to connect to facebook (authenticating) when the button is clicked.

    This is not some special viewcontroller or something.

    I have seen this: http://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/authenticate/

    but in there i need to create some things in the delegate (like a UINavigationController) that i can't use because i am using a UITabBarController..

    how can i implement facebook login and session creation just from pushing the UINavigationItem?

    Here is my AppDelegate.h:

    #import <UIKit/UIKit.h>
    #import <FacebookSDK/FacebookSDK.h>
    
    @interface AppDelegate : UIResponder <UIApplicationDelegate>
    
    @property (strong, nonatomic) UIWindow *window;
    @property (strong, nonatomic) UITabBarController *tbc;
    
    @property (strong, nonatomic) FBSession *session;
    
    
    @end
    

    And my AppDelegate.m:

    #import "AppDelegate.h"
    #import "StatusView.h"
    #import "JokesView.h"
    #import "HomeView.h"
    #import "TopTenView.h"
    #import "UploadView.h"
    
    @implementation AppDelegate
    
    @synthesize tbc;
    @synthesize window = _window;
    @synthesize session = _session;
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        // Override point for customization after application launch.
        self.window.backgroundColor = [UIColor whiteColor];
    
        UINavigationController*nav1 = [[UINavigationController alloc]init];
        UINavigationController*nav2 = [[UINavigationController alloc]init];
        UINavigationController*nav3 = [[UINavigationController alloc]init];
        UINavigationController*nav4 = [[UINavigationController alloc]init];
        UINavigationController*nav5 = [[UINavigationController alloc]init];
    
        StatusView*page1 = [[StatusView alloc]initWithNibName:@"StatusView" bundle:nil];
        JokesView*page2 = [[JokesView alloc]initWithNibName:@"JokesView" bundle:nil];
        HomeView*page3 = [[HomeView alloc]initWithNibName:@"HomeView" bundle:nil];
        TopTenView*page4 = [[TopTenView alloc]initWithNibName:@"TopTenView" bundle:nil];
        UploadView*page5 = [[UploadView alloc]initWithNibName:@"UploadView" bundle:nil];
    
        page1.title = @"סטטוסים";
        page2.title = @"תמונות";
        page3.title = @"ראשי";
        page4.title = @"Top 10";
        page5.title = @"העלאה";
    
        UITabBarItem *tab1 = [[UITabBarItem alloc] initWithTitle:@"Status"
                                                           image:[UIImage imageNamed:@"tbc-status.png"] tag:1];
        [nav1 setTabBarItem:tab1];
    
        UITabBarItem *tab2 = [[UITabBarItem alloc] initWithTitle:@"Jokes"
                                                           image:[UIImage imageNamed:@"tbc-jokes.png"] tag:1];
        [nav2 setTabBarItem:tab2];
    
        UITabBarItem *tab3 = [[UITabBarItem alloc] initWithTitle:@"Home"
                                                           image:[UIImage imageNamed:@"tbc-home.png"] tag:1];
        [nav3 setTabBarItem:tab3];
    
        UITabBarItem *tab4 = [[UITabBarItem alloc] initWithTitle:@"Tpp10"
                                                           image:[UIImage imageNamed:@"tbc-topten.png"] tag:1];
        [nav4 setTabBarItem:tab4];
    
        UITabBarItem *tab5 = [[UITabBarItem alloc] initWithTitle:@"Upload"
                                                           image:[UIImage imageNamed:@"tbc-upload.png"] tag:1];
        [nav5 setTabBarItem:tab5];
    
    
        [nav1 pushViewController:page1 animated:NO];
        [nav2 pushViewController:page2 animated:NO];
        [nav3 pushViewController:page3 animated:NO];
        [nav4 pushViewController:page4 animated:NO];
        [nav5 pushViewController:page5 animated:NO];
    
        tbc = [[UITabBarController alloc]init];
        tbc.viewControllers = [NSArray arrayWithObjects:nav5,nav4,nav3,nav2,nav1, nil];
        tbc.selectedIndex = 2;
    
        // NavBar Design
        UIImage *navbarPortrait = [[UIImage imageNamed:@"topbar.jpg"]
                                   resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
        UIImage *navbarLandscape = [[UIImage imageNamed:@"topbar.jpg"]
                                    resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
    
        [[UINavigationBar appearance] setBackgroundImage:navbarPortrait
                                           forBarMetrics:UIBarMetricsDefault];
        [[UINavigationBar appearance] setBackgroundImage:navbarLandscape
                                           forBarMetrics:UIBarMetricsLandscapePhone];
        // NavBar Design End
    
        // TabBar Design
        UIImage *tabBackground = [[UIImage imageNamed:@"tbcb3ack.png"]
                                  resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
        [[UITabBar appearance] setBackgroundImage:tabBackground];
        [[tbc tabBar] setBackgroundImage:tabBackground];
        // TabBar Design End
    
        [self.window addSubview:tbc.view];
        self.window.rootViewController = self.tbc;
    
        // Push Notifications
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeNone)];
        // Push Notifications End
    
        // Facebook Code Start
    
        //UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Not Logged in"
        //                                                message:@"You Log in to use all the fearues in this app"
        //                                               delegate:nil
        //                                      cancelButtonTitle:@"OK"
        //                                      otherButtonTitles:nil];
    
        if (FBSession.activeSession.state == FBSessionStateCreatedTokenLoaded) {
            // To-do, show logged in view
        } else {
            //[alert show];
    
        }
    
        // Facebook Code End
    
        [self.window makeKeyAndVisible];
        return YES;
    
    }
    
    // Facebook sdk code Start
    
    - (BOOL)application:(UIApplication *)application
                openURL:(NSURL *)url
      sourceApplication:(NSString *)sourceApplication
             annotation:(id)annotation {
        // attempt to extract a token from the url
        return [FBAppCall handleOpenURL:url
                      sourceApplication:sourceApplication
                            withSession:self.session];
    }
    
    // Facebook sdk code End
    
    - (void)applicationWillResignActive:(UIApplication *)application
    {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }
    
    - (void)applicationDidEnterBackground:(UIApplication *)application
    {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }
    
    - (void)applicationWillEnterForeground:(UIApplication *)application
    {
        // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
    }
    
    - (void)applicationDidBecomeActive:(UIApplication *)application
    {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }
    
    - (void)applicationWillTerminate:(UIApplication *)application
    {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
            [FBAppCall handleDidBecomeActiveWithSession:self.session];
    }
    #pragma mark Template generated code
    
    @end
    

    These are after i used the facebook ios authentication tutorial, before the actual fb session changes and login button.

    • Admin
      Admin over 11 years
      i have ubuntu 12.04
    • laxonline
      laxonline almost 11 years
      what you have tried? Can you post some code?
    • Eliran Efron
      Eliran Efron almost 11 years
      i tried just that one and some old tutorial... i have no current code because it just didn't work out as i am trying no to use the login as a full viewcontroller but as a function of anyviewcontroller i have/
  • petros
    petros over 11 years
    Hey German thanks for your answer!When i write " sudo nano /etc/apt/sources.list. " it opens the file on terminal but there is nothing there,how i can read the file?the note in the end of the page doesn't help
  • Oleksandr Shmyrko
    Oleksandr Shmyrko over 11 years
    try again without the dot at the end: "sudo nano /etc/apt/sources.list"
  • Eliran Efron
    Eliran Efron almost 11 years
    i don't want to implant in a new viewcontroller but to use is as a function in an exsiting one... is that possible?
  • Eliran Efron
    Eliran Efron almost 11 years
    can you give me a code example? and i don't want any popup, i want it to move to the facebook app for the validation and come back.
  • Eliran Efron
    Eliran Efron almost 11 years
    thanks for the awesome comment! which files do i need to import for this? and do i need the session function on every page? i wan't the app to remember the user trhow all of it's pages. thanks :)
  • Mr. T
    Mr. T almost 11 years
    Ahh, I'm starting to see what you need. So you actually want the login/logout button to stay with the navigation controller regardless which view controller is showing right? If that's the case, then you need to subclass the UINavigationController, add this as part of your subclass, and handle all facebook logic in the nav controller. If this is the case, just tell me, and I can edit my answer to be more specific.
  • Eliran Efron
    Eliran Efron almost 11 years
    yes this is it! i will be happy if you could show me how to do it :)
  • Eliran Efron
    Eliran Efron almost 11 years
    wow, amazing answer !! thank you very much :) about the update: i need to create a MYNavigationController.m file and than import it to every viewcontroller i have? and than inside the viewdidload do something like self.navigationitem.leftbarbuttonitem = facebookButton; ?
  • Mr. T
    Mr. T almost 11 years
    Not exactly. I call the UINavigationController subclass MYNavigationController, but you can call it whatever you want. This navigation controller (NC) will be the root view controller (VC) in your app. Then you can push and pop VCs to this NC just as you would any vanilla (non-subclassed) NC. You don't need to do anything inside of the VCs as this NC subclass will take care of adding the bar button. So in summary, create your project, make your root view a navigation controller (you can do this in storyboard), set its class to your NC subclass, start adding your VCs to this NC like normal.
  • Eliran Efron
    Eliran Efron almost 11 years
    thanks, i'll try it tommorrow and let you know :) the thing i think i would have a problem with is that i have a tabbar in my delegate that inside picks which .xib file will be first to load.
  • Mr. T
    Mr. T almost 11 years
    Shouldn't be a problem unless you want each tab bar's tabs to have the same facebook button on the navigation bar. If it's only on a single navigation bar, then the nested structure of your app would be: app window > tab bar > navigation controllers (multiple, with one as your navigation controller subclass) > view controllers (pushed and popped into your navigation controller).
  • Eliran Efron
    Eliran Efron almost 11 years
    Yes... The tab bar is the pages and every one of them need to have the button in the nav bar.
  • Mr. T
    Mr. T almost 11 years
    Alright... help me understand the structure of your application. When you first load the application, is the root view controller of your main window a UITabBar or a UINavigationController? In other words, do you have a UITabBar nested inside a UINavigationController, or the other way around? Also, when you say every one of them needs to have the button, are you referring to every view controller, or every tab in your tab bar?
  • Eliran Efron
    Eliran Efron almost 11 years
    my app works like this: i have a delegate which has a proprety of uitabbarcontroller. in the delegate.m , inside the "didFunishLaunchingWithOptions" i am calling all my viewcontrollers and than do: tabbarcontroller.viewcontrollers = array of the VCs. and than i select the index and thats the view controller my app launches first. i will now add my appdelegate.h and appdelegate.m to the main question.
  • Eliran Efron
    Eliran Efron almost 11 years
    hey, i don't really have a root viewcontroller.... in my delegate i have a function thant builds the UITabBarController and than i chose the index of it and this becomes the view... so i don't have something like "MYTabBarController" as i see in your answer what i would need to do is add the functions you put in the "MYTabBarController" into every viewcontroller i have that i wan't that button in, and than change what i have in my delegate?! i kind of lost you somewhere there..
  • Mr. T
    Mr. T almost 11 years
    Well, instead of using the vanilla UITabBarController, you want to use a subclass of UITabBarController that you create. I happen to call my subclass MYTabBarController, but you can call it whatever you want. In the end, the purpose of this specialized subclass is to hold onto this facebook button that you're sharing across all the tabs of your UITabBar. Does that make sense?
  • Eliran Efron
    Eliran Efron almost 11 years
    my problem is that i don't have a "UITabBarController" as a page (.m/.h), what i use as my UITabBarController is decleard in the appDelegate.m
  • Eliran Efron
    Eliran Efron almost 11 years
    I am trying to understand where to put your code... can you be more specific?
  • Mr. T
    Mr. T almost 11 years
    You need to make a UITabBarController subclass. Go to XCode, File > New > File, select Objective-C class, name it what you want but make sure it's a subclass of UITabBarController. Then put the code in there. Inside your __AppDelegate.m, add a #include "<insert name of new UITabBarController>.h" at the top, and instantiate an instance of your new class instead of the generic UITabBarController.
  • Eliran Efron
    Eliran Efron almost 11 years
    and than do something like: self.window.rootViewController = MyTbc; ?
  • Eliran Efron
    Eliran Efron almost 11 years
    i made it end everytime i press the button i get an error: 2013-07-04 20:46:37.890 Delike[24650:907] -[__NSCFType onFacebookButtonClick:]: unrecognized selector sent to instance 0x1c557130
  • Eliran Efron
    Eliran Efron almost 11 years
    can i send you the app files and you will fix it?
  • Mr. T
    Mr. T almost 11 years
    hmm, that would be robbing you of a great chance to learn how all this stuff works. I'm happy to continue this in chat and help you work through some of the bugs, but you should be the one driving. Jump in this chatroom: chat.stackoverflow.com/rooms/32905/…