Trying to build my first iOS External
Posted: Mon Jul 15, 2013 5:11 am
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...