Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

keantan

macrumors regular
Original poster
Nov 6, 2008
163
0
Penang, Malaysia
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!
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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?
 

keantan

macrumors regular
Original poster
Nov 6, 2008
163
0
Penang, Malaysia
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?

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?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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?

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.
 

keantan

macrumors regular
Original poster
Nov 6, 2008
163
0
Penang, Malaysia
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:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.