Trying to build my first iOS External
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Trying to build my first iOS External
Hi,
Firstly, let me declare I have zero idea about any other programming language other than LC!!
That being said I am needing to build an IOS External to retrieve the SSID of the currently connected WiFi network (will use mergNic to confirm the device is actually connected to a WiFi Network )
Monte has been a great help and pointed me to a stack overflow question which has given me what I believe I need to achieve this and after following the Externals Guide from RunRev I have managed to make a start.
I am now at the point of adding the required detail to mm file about the "Method" ??? I need to use to do this (Hopefully)
This is the code I have in the mm file from the stack overflow question but I keep getting the following errors in XCode
: Expected a type and : Missing context for method declaration
#import <SystemConfiguration/CaptiveNetwork.h>
+ (NSString *)currentWifiSSID {
// Does not work on the simulator.
NSString *ssid = nil;
NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces();
for (NSString *ifnam in ifs) {
NSDictionary *info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
if (info[@"SSID"]) {
ssid = info[@"SSID"];
}
}
return ssid;
}
this is my .idl file
//
// ioswifissid.lcidlc
// ioswifissid
//
// Created by Nakia Brewer on 15/07/13.
// Copyright 2013 Nakia Brewer. All rights reserved.
//
// The name of the external (note external name must be all lowercase!)
external ioswifissid
use c++-naming
use objc-objects
command currentWifiSSID
out ssid as objc-string
Any pointers would be greatly appreciated...
Firstly, let me declare I have zero idea about any other programming language other than LC!!
That being said I am needing to build an IOS External to retrieve the SSID of the currently connected WiFi network (will use mergNic to confirm the device is actually connected to a WiFi Network )
Monte has been a great help and pointed me to a stack overflow question which has given me what I believe I need to achieve this and after following the Externals Guide from RunRev I have managed to make a start.
I am now at the point of adding the required detail to mm file about the "Method" ??? I need to use to do this (Hopefully)
This is the code I have in the mm file from the stack overflow question but I keep getting the following errors in XCode
: Expected a type and : Missing context for method declaration
#import <SystemConfiguration/CaptiveNetwork.h>
+ (NSString *)currentWifiSSID {
// Does not work on the simulator.
NSString *ssid = nil;
NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces();
for (NSString *ifnam in ifs) {
NSDictionary *info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
if (info[@"SSID"]) {
ssid = info[@"SSID"];
}
}
return ssid;
}
this is my .idl file
//
// ioswifissid.lcidlc
// ioswifissid
//
// Created by Nakia Brewer on 15/07/13.
// Copyright 2013 Nakia Brewer. All rights reserved.
//
// The name of the external (note external name must be all lowercase!)
external ioswifissid
use c++-naming
use objc-objects
command currentWifiSSID
out ssid as objc-string
Any pointers would be greatly appreciated...
Re: Trying to build my first iOS External
lastly, if anyone has some suggestions on good books/online courses to learn objective c that would be also greatly appreciated..
-
- VIP Livecode Opensource Backer
- Posts: 281
- Joined: Sat Jun 04, 2011 5:41 pm
- Location: Switzerland
Re: Trying to build my first iOS External
This is a good book that I can suggest ... iPhone Programming: The Big Nerd Ranch Guide http://www.amazon.com/iOS-Programming-R ... anch+GuideNakia wrote:lastly, if anyone has some suggestions on good books/online courses to learn objective c that would be also greatly appreciated..

Guglielmo
Re: Trying to build my first iOS External
Thanks for the reply..
I think I will need to cancel this project, obj-c is just beyond my skill set for now until I do a LOT of heavy reading.
Cheers
I think I will need to cancel this project, obj-c is just beyond my skill set for now until I do a LOT of heavy reading.
Cheers
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Trying to build my first iOS External
Hi Nakia,
There is this:
http://www.runrevplanet.com/index.php?o ... &Itemid=65
But I don't know if Pascal is easier or more difficult.
Simon
There is this:
http://www.runrevplanet.com/index.php?o ... &Itemid=65
But I don't know if Pascal is easier or more difficult.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Trying to build my first iOS External
Hey Kia... sorry I didn't see this post. You're nearly there mate:
ioswifissid.mm
ioswifissid.lcidl
ioswifissid.mm
Code: Select all
#import <SystemConfiguration/CaptiveNetwork.h>
NSString * currentWifiSSID (void)
{
// Does not work on the simulator.
NSString *ssid = nil;
NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces();
for (NSString *ifnam in ifs)
{
NSDictionary *info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
ssid = [info objectForKey:@"SSID"];
if (ssid)
break;
}
return ssid ? ssid : @"";
}
Code: Select all
//
// ioswifissid.lcidlc
// ioswifissid
//
// Created by Nakia Brewer on 15/07/13.
// Copyright 2013 Nakia Brewer. All rights reserved.
//
// The name of the external (note external name must be all lowercase!)
external ioswifissid
use c++-naming
use objc-objects
command currentWifiSSID
return objc-string
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
Re: Trying to build my first iOS External
Sorry about my huge delay in response, been moving house.
Thanks for everyone's replies, I will give this a spin tomorrow and report back on my result.
If I manage to get it to work I'll happily upload the compiled external here just in case someone else has a use for it.
Cheers
Thanks for everyone's replies, I will give this a spin tomorrow and report back on my result.
If I manage to get it to work I'll happily upload the compiled external here just in case someone else has a use for it.
Cheers
Re: Trying to build my first iOS External
Finally got back to this today,
my XCode still spewing out errors like crazy with just you code Monte.
Maybe there is a setting wrong in my project?
my XCode still spewing out errors like crazy with just you code Monte.
Maybe there is a setting wrong in my project?
Re: Trying to build my first iOS External
Hmmm, importing Foundation.h seemed to help....
# import <Foundation/Foundation.h>
Only getting "yellow" errors now but the build succeeds..
so, I thought I might try it on a device..
I have used the copy files pane to add the ioswifissid.lcext
and I have a button with
on mouseUp
put currentWifiSSID into tSSID
answer tSSID
end mouseUp
unfortunately all I get answered is "currentWifiSSID"
# import <Foundation/Foundation.h>
Only getting "yellow" errors now but the build succeeds..
so, I thought I might try it on a device..
I have used the copy files pane to add the ioswifissid.lcext
and I have a button with
on mouseUp
put currentWifiSSID into tSSID
answer tSSID
end mouseUp
unfortunately all I get answered is "currentWifiSSID"
Re: Trying to build my first iOS External
Hi Nakia,
does it work when you use it like a function, which it obviously is:
...
put currentWifiSSID() into tSSID
answer tSSID
...
Just guessing, no idea about C etc...
Best
Klaus
does it work when you use it like a function, which it obviously is:
...
put currentWifiSSID() into tSSID
answer tSSID
...
Just guessing, no idea about C etc...

Best
Klaus
Re: Trying to build my first iOS External
It's a command:
Might want to change it to a function I think...
Code: Select all
currentWifiSSID
answer the result
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
Re: Trying to build my first iOS External
Thanks for the replies and sorry to ask what may appear as dumb questions,
this is just very new for me and I have ZERO knowledge on C (although I plan to learn)
Good news is it actually works and as promised I have uploaded it.
As Monte pointed out you need to use
currentWifiSSID
answer the result
The result will be empty if no wireless network is connected.
this is just very new for me and I have ZERO knowledge on C (although I plan to learn)
Good news is it actually works and as promised I have uploaded it.
As Monte pointed out you need to use
currentWifiSSID
answer the result
The result will be empty if no wireless network is connected.
- Attachments
-
- ioswifissid.lcext.zip
- (13.33 KiB) Downloaded 525 times
Re: Trying to build my first iOS External
Hi Kia
Good stuff.
Can I recommend putting it on GitHub and putting a license on it. The more stuff up there for the platform the better.
Cheers
Monte
Good stuff.
Can I recommend putting it on GitHub and putting a license on it. The more stuff up there for the platform the better.
Cheers
Monte
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
Re: Trying to build my first iOS External
Managed to get it on Github with a license as suggested.
Placed under description "ioswifissid" - Livecode IOS External - Get WIFI SSID
Placed under description "ioswifissid" - Livecode IOS External - Get WIFI SSID
Re: Trying to build my first iOS External
Hello.
I tested your extension at the time and it was working great.
Now on iOS 15 I am not abale to install it anymore.
Do you have any clue?
Will you ever create the same extension for Android?
Thanks
I tested your extension at the time and it was working great.
Now on iOS 15 I am not abale to install it anymore.
Do you have any clue?
Will you ever create the same extension for Android?
Thanks
Trevix
OSX 12.5.1 xCode 13.2 LC 9.6.8 iOs 15> Android 7>
OSX 12.5.1 xCode 13.2 LC 9.6.8 iOs 15> Android 7>