Unknown Error

Discussion in 'iOS Programming' started by keantan, Nov 16, 2010.

  1. keantan macrumors regular

    Joined:
    Nov 6, 2008
    Location:
    Penang, Malaysia
    #1
    Hi everyone,

    I'm in the midst of making my first iPhone app, for a university project.

    First a bit of info:
    I've got a program spread across multiple files, each file contributing a "module" to the final project, one such is called bluetoothModule

    I have calls to the code in bluetoothModule from the view controller:

    Code:
    [bluetoothModule.connect = setHidden:NO];
    [bluetoothModule.disconnect = setHidden:YES];
    When I try and compile the code, I recieve the error:

    "Expected ':' before '.' token (2)

    I've already imported the header file bluetoothModule.h at the top of the file so I don't see why its not recognising it. One thing worth noting though, when all the code is in the viewcontroller file. It all runs fine.

    Hope someone can help this is giving a massive headache.
    Thanks!
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    That is not Objective-C syntax. You can either assign to a property (the equals sign) or call a method (the square brackets), but not combined like that. Care you explain what you thought that would do?
     
  3. keantan thread starter macrumors regular

    Joined:
    Nov 6, 2008
    Location:
    Penang, Malaysia
    #3
    It's to set the property of a button. It was written like that in some sample code i was looking at and it worked just fine. I know it's technically copying but all the best ideas are.

    The buttons appear to allow the connection/disconnection of a Bluetooth connection between two iPod touches.

    How would i write it in this case?
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    I'm not going to show you how to write anything. Someone else did that and it's clear that did not help you learn. Where is this sample code?

    In all honesty I suggest you stop writing code and go learn the language. What you have is not valid code. Start with Apple's Introduction to Objective-C. Do not attempt any more code until you have read and understood the whole document.
     
  5. keantan thread starter macrumors regular

    Joined:
    Nov 6, 2008
    Location:
    Penang, Malaysia
    #6
    Thanks for both your inputs regardless. I will read through both of those again. I skimmed through the Objective C primer briefly coming from C suppose I need to refer to it again. :eek:
     

Share This Page