Skip to content

Commit b93b4e4

Browse files
committed
Fixed issues with Xcode 9 compatibility
1 parent 33bd7ea commit b93b4e4

File tree

13 files changed

+240
-233
lines changed

13 files changed

+240
-233
lines changed

MMLanScan.podspec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
Pod::Spec.new do |s|
22
s.name = 'MMLanScan'
3-
s.version = '2.2.0'
3+
s.version = '3.0.0'
44
s.summary = 'MMLanScan is an open source project for iOS that helps you scan your network and shows the available devices.'
55

66
s.description = <<-DESC
7-
MMLanScan is an open source project for iOS that helps you scan your network and shows the available devices and their MAC Address, hostname and Brand name. For those updating from 2.1.2 please note that "Device" class has been renamed to "MMDevice".
7+
MMLanScan is an open source project for iOS that helps you scan your network and shows the available devices and their MAC Address, hostname and Brand name. For those updating from 2.1.2 please note that "Device" class has been renamed to "MMDevice".
8+
For those updating from 2.2.0 to 3.0.0 please note that you won't be able to see MAC Addresses and Brands because of a restriction of iOS 11.
89
910
Features
1011
+ Scans and finds available hosts in your network
1112
+ Shows IP Address
12-
+ Shows MAC Address
13-
+ Shows Brand of device based on MAC Address
13+
+ Shows MAC Address (iOS 10 and below)
14+
+ Shows Brand of device based on MAC Address (iOS 10 and below)
1415
+ Shows hostname (if available)
1516
+ Scan any subnet (not only /24)
1617
+ Gives you the ability to update the OUI (MAC-Brand mappings) plist file. Check in MainPresenter.m for more details

MMLanScan/External Libs/MacFinder/MacFinder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#import <Foundation/Foundation.h>
1010

1111
#if TARGET_IPHONE_SIMULATOR
12-
#include <net/route.h>
12+
#include "route.h"
1313
#else
1414
#include "route.h"
1515
#endif

MMLanScan/External Libs/MacFinder/Network Headers/route.h

Lines changed: 138 additions & 153 deletions
Large diffs are not rendered by default.

MMLanScan/External Libs/SimplePing/SimplePing.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,17 @@ struct IPHeader {
138138
};
139139
typedef struct IPHeader IPHeader;
140140

141-
check_compile_time(sizeof(IPHeader) == 20);
142-
check_compile_time(offsetof(IPHeader, versionAndHeaderLength) == 0);
143-
check_compile_time(offsetof(IPHeader, differentiatedServices) == 1);
144-
check_compile_time(offsetof(IPHeader, totalLength) == 2);
145-
check_compile_time(offsetof(IPHeader, identification) == 4);
146-
check_compile_time(offsetof(IPHeader, flagsAndFragmentOffset) == 6);
147-
check_compile_time(offsetof(IPHeader, timeToLive) == 8);
148-
check_compile_time(offsetof(IPHeader, protocol) == 9);
149-
check_compile_time(offsetof(IPHeader, headerChecksum) == 10);
150-
check_compile_time(offsetof(IPHeader, sourceAddress) == 12);
151-
check_compile_time(offsetof(IPHeader, destinationAddress) == 16);
141+
__Check_Compile_Time(sizeof(IPHeader) == 20);
142+
__Check_Compile_Time(offsetof(IPHeader, versionAndHeaderLength) == 0);
143+
__Check_Compile_Time(offsetof(IPHeader, differentiatedServices) == 1);
144+
__Check_Compile_Time(offsetof(IPHeader, totalLength) == 2);
145+
__Check_Compile_Time(offsetof(IPHeader, identification) == 4);
146+
__Check_Compile_Time(offsetof(IPHeader, flagsAndFragmentOffset) == 6);
147+
__Check_Compile_Time(offsetof(IPHeader, timeToLive) == 8);
148+
__Check_Compile_Time(offsetof(IPHeader, protocol) == 9);
149+
__Check_Compile_Time(offsetof(IPHeader, headerChecksum) == 10);
150+
__Check_Compile_Time(offsetof(IPHeader, sourceAddress) == 12);
151+
__Check_Compile_Time(offsetof(IPHeader, destinationAddress) == 16);
152152

153153
// ICMP type and code combinations:
154154

@@ -169,9 +169,9 @@ struct ICMPHeader {
169169
};
170170
typedef struct ICMPHeader ICMPHeader;
171171

172-
check_compile_time(sizeof(ICMPHeader) == 8);
173-
check_compile_time(offsetof(ICMPHeader, type) == 0);
174-
check_compile_time(offsetof(ICMPHeader, code) == 1);
175-
check_compile_time(offsetof(ICMPHeader, checksum) == 2);
176-
check_compile_time(offsetof(ICMPHeader, identifier) == 4);
177-
check_compile_time(offsetof(ICMPHeader, sequenceNumber) == 6);
172+
__Check_Compile_Time(sizeof(ICMPHeader) == 8);
173+
__Check_Compile_Time(offsetof(ICMPHeader, type) == 0);
174+
__Check_Compile_Time(offsetof(ICMPHeader, code) == 1);
175+
__Check_Compile_Time(offsetof(ICMPHeader, checksum) == 2);
176+
__Check_Compile_Time(offsetof(ICMPHeader, identifier) == 4);
177+
__Check_Compile_Time(offsetof(ICMPHeader, sequenceNumber) == 6);

MMLanScan/Misc/MACOperation.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ -(void)getMACDetails{
9999
self.device.ipAddress=self.ipStr;
100100
self.device.macAddress =[[MacFinder ip2mac:self.device.ipAddress] uppercaseString];
101101
self.device.hostname = [LANProperties getHostFromIPAddress:self.ipStr];
102-
102+
103103
if (!self.device.macAddress) {
104-
105104
errorMessage = [NSError errorWithDomain:@"MAC Address Not Exist" code:10 userInfo:nil];
106105
}
107106
else {

MMLanScanDemo/MMLanScanDemo.xcodeproj/project.pbxproj

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,13 @@
290290
279335BA1D5D1CB9001DFE84 /* Project object */ = {
291291
isa = PBXProject;
292292
attributes = {
293-
LastUpgradeCheck = 0800;
293+
LastUpgradeCheck = 0900;
294294
ORGANIZATIONNAME = Miksoft;
295295
TargetAttributes = {
296296
279335C11D5D1CB9001DFE84 = {
297297
CreatedOnToolsVersion = 7.3;
298-
ProvisioningStyle = Manual;
298+
DevelopmentTeam = JSY962FCU8;
299+
ProvisioningStyle = Automatic;
299300
};
300301
};
301302
};
@@ -385,14 +386,20 @@
385386
CLANG_CXX_LIBRARY = "libc++";
386387
CLANG_ENABLE_MODULES = YES;
387388
CLANG_ENABLE_OBJC_ARC = YES;
389+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
388390
CLANG_WARN_BOOL_CONVERSION = YES;
391+
CLANG_WARN_COMMA = YES;
389392
CLANG_WARN_CONSTANT_CONVERSION = YES;
390393
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
391394
CLANG_WARN_EMPTY_BODY = YES;
392395
CLANG_WARN_ENUM_CONVERSION = YES;
393396
CLANG_WARN_INFINITE_RECURSION = YES;
394397
CLANG_WARN_INT_CONVERSION = YES;
398+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
399+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
395400
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
401+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
402+
CLANG_WARN_STRICT_PROTOTYPES = YES;
396403
CLANG_WARN_SUSPICIOUS_MOVE = YES;
397404
CLANG_WARN_UNREACHABLE_CODE = YES;
398405
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -431,14 +438,20 @@
431438
CLANG_CXX_LIBRARY = "libc++";
432439
CLANG_ENABLE_MODULES = YES;
433440
CLANG_ENABLE_OBJC_ARC = YES;
441+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
434442
CLANG_WARN_BOOL_CONVERSION = YES;
443+
CLANG_WARN_COMMA = YES;
435444
CLANG_WARN_CONSTANT_CONVERSION = YES;
436445
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
437446
CLANG_WARN_EMPTY_BODY = YES;
438447
CLANG_WARN_ENUM_CONVERSION = YES;
439448
CLANG_WARN_INFINITE_RECURSION = YES;
440449
CLANG_WARN_INT_CONVERSION = YES;
450+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
451+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
441452
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
453+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
454+
CLANG_WARN_STRICT_PROTOTYPES = YES;
442455
CLANG_WARN_SUSPICIOUS_MOVE = YES;
443456
CLANG_WARN_UNREACHABLE_CODE = YES;
444457
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -467,12 +480,14 @@
467480
buildSettings = {
468481
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
469482
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
470-
DEVELOPMENT_TEAM = "";
483+
CODE_SIGN_STYLE = Automatic;
484+
DEVELOPMENT_TEAM = JSY962FCU8;
471485
INFOPLIST_FILE = "$(SRCROOT)/MMLanScanDemo/Info.plist";
472486
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
473487
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
474488
PRODUCT_BUNDLE_IDENTIFIER = com.miksoft.MMLanScanDemo;
475489
PRODUCT_NAME = "$(TARGET_NAME)";
490+
PROVISIONING_PROFILE = "";
476491
PROVISIONING_PROFILE_SPECIFIER = "";
477492
};
478493
name = Debug;
@@ -482,12 +497,14 @@
482497
buildSettings = {
483498
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
484499
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
485-
DEVELOPMENT_TEAM = "";
500+
CODE_SIGN_STYLE = Automatic;
501+
DEVELOPMENT_TEAM = JSY962FCU8;
486502
INFOPLIST_FILE = "$(SRCROOT)/MMLanScanDemo/Info.plist";
487503
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
488504
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
489505
PRODUCT_BUNDLE_IDENTIFIER = com.miksoft.MMLanScanDemo;
490506
PRODUCT_NAME = "$(TARGET_NAME)";
507+
PROVISIONING_PROFILE = "";
491508
PROVISIONING_PROFILE_SPECIFIER = "";
492509
};
493510
name = Release;

MMLanScanDemo/MMLanScanDemo.xcworkspace/xcshareddata/MMLanScanDemo.xcscmblueprint

Lines changed: 0 additions & 30 deletions
This file was deleted.

MMLanScanDemo/MMLanScanDemo/Base.lproj/Main.storyboard

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="1IZ-zd-V16">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="1IZ-zd-V16">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
36
<dependencies>
47
<deployment identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
69
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
710
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
811
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -21,6 +24,7 @@
2124
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2225
<subviews>
2326
<progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="MNB-Sm-KTC">
27+
<rect key="frame" x="8" y="81" width="359" height="2"/>
2428
<constraints>
2529
<constraint firstAttribute="height" constant="2" id="aMl-Mf-THE"/>
2630
</constraints>
@@ -36,16 +40,18 @@
3640
</variation>
3741
</progressView>
3842
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="60" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="hAg-I0-HZX">
43+
<rect key="frame" x="0.0" y="104" width="375" height="563"/>
3944
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
4045
<prototypes>
4146
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="DeviceCell" rowHeight="60" id="nDz-jn-o1z" customClass="DeviceCell">
4247
<rect key="frame" x="0.0" y="28" width="375" height="60"/>
4348
<autoresizingMask key="autoresizingMask"/>
4449
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="nDz-jn-o1z" id="Xmf-Jn-nu3">
45-
<frame key="frameInset" width="375" height="59"/>
50+
<rect key="frame" x="0.0" y="0.0" width="375" height="59.5"/>
4651
<autoresizingMask key="autoresizingMask"/>
4752
<subviews>
4853
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="192.168.111.200" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="o7Y-Yh-Vjx">
54+
<rect key="frame" x="8" y="8" width="166" height="24"/>
4955
<constraints>
5056
<constraint firstAttribute="width" constant="166" id="6pK-K2-3Js"/>
5157
<constraint firstAttribute="height" constant="24" id="KbP-eV-iXN"/>
@@ -66,12 +72,14 @@
6672
</mask>
6773
</variation>
6874
</label>
69-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="A1:B2:C3:D4" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PwU-Be-Kdf">
75+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PwU-Be-Kdf">
76+
<rect key="frame" x="8" y="30" width="166" height="24"/>
7077
<fontDescription key="fontDescription" type="system" pointSize="16"/>
7178
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
7279
<nil key="highlightedColor"/>
7380
</label>
74-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Brand" textAlignment="right" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="RC7-2V-jAq">
81+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="right" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="RC7-2V-jAq">
82+
<rect key="frame" x="182" y="3" width="185" height="40"/>
7583
<constraints>
7684
<constraint firstAttribute="height" constant="40" id="fkI-EZ-et3"/>
7785
</constraints>
@@ -90,6 +98,7 @@
9098
</variation>
9199
</label>
92100
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="8Bx-4c-wTc">
101+
<rect key="frame" x="182" y="38" width="185" height="21"/>
93102
<constraints>
94103
<constraint firstAttribute="height" constant="21" id="d8q-vt-qCL"/>
95104
</constraints>
@@ -253,7 +262,7 @@
253262
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="1IZ-zd-V16" sceneMemberID="viewController">
254263
<toolbarItems/>
255264
<navigationBar key="navigationBar" contentMode="scaleToFill" id="ZGu-1Z-xUC">
256-
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
265+
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
257266
<autoresizingMask key="autoresizingMask"/>
258267
</navigationBar>
259268
<nil name="viewControllers"/>

MMLanScanDemo/MMLanScanDemo/MainVC.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSI
137137
MMDevice *nd = [self.presenter.connectedDevices objectAtIndex:indexPath.row];
138138

139139
cell.ipLabel.text = nd.ipAddress;
140-
cell.macAddressLabel.text = nd.macAddress;
141140
cell.brandLabel.text = nd.isLocalDevice ? @"Your device" : nd.brand;
142-
cell.hostnameLabel.text= nd.hostname;
141+
142+
//Won't work on iOS 11
143+
//cell.macAddressLabel.text = nd.macAddress;
144+
//cell.hostnameLabel.text= nd.hostname;
143145

144146
return cell;
145147
}

0 commit comments

Comments
 (0)