App directly installing from xcode and installing from AppStore behaves differently.

Hello,
I have developed one smart home based application for one of our product,
In an App i am fetching iphone's current wifi ssid it through an API,

The problem is when i compile the app through xcode and directly install it from xcode to an iphone that version runs very fine in a same phone,

But i uploaded the same app to App Store and when i download from it it can not detect the wifi ssid,

Please elaborate this problem to me?


This is the function i am using to fetch ssid


- (NSString *) getSSID {

NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces();

wifiName = @"";

for (NSString *ifnam in ifs) {

NSDictionary *info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);

if (info[@"SSID"]) {

wifiName = info[@"SSID"];

}

}

return wifiName;

}

Replies

There’s two common sources of this problem:

  • Entitlements (A)

  • Optimisation (B)

Let’s cover B first. Most folks do day-to-day debugging with a Debug build of their app, and that Debug build defaults to having optimisations turned off (which makes the debugger work much better). When you do a Product > Archive, that creates a Release build of your app, which defaults to having optimisations turned on. It’s very easy to write code that behaves differently based on whether the optimiser is on or off. This is especially true in C-based languages, which are full of undefined behaviour.

To investigate this, take the archive that you submitted to the App store and export a Development-signed executable that you can run on your device:

  1. Go to the Archives tab of the Organizer.

  2. On the left, select the archive that you submitted to the App Store.

  3. Click Distribute App.

  4. Select Development and click Next.

  5. Follow the path from there.

If this app fails in the same way as your App Store app, you can debug from there.

If this app works, it’s time to look at entitlements.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hello,

Thanks for the answer,

I tried doing using same binary and export it for development signed executable than upload it on my device.

It works fine from the problem i am facing via app store development version.

Try doing an ad-hoc build....they sometimes better replicate a store dist.


Orgainzer, Archive. <select app on left>, Distribure App, Ad Hoc...

Thanks eskimo,

I tried both development and ad-hoc version and upload it in phone,

But it's working.

I tried both development and ad-hoc version and upload it in phone, But it's working.

The next step is to export the same

.xcarchive
as a
.ipa
and check its entitlements:
  1. In the Organizer, select that archive and click Distribute App.

  2. Select iOS App Store and click Next.

  3. Select Export and click Next.

  4. From here, choose the same settings as you did when you uploaded to the store.

  5. The end result is a directory containing, amongst other things, a

    .ipa
    . Rename that to a
    .zip
    and then unpack it.
  6. Find your app within the unpacked directory.

  7. Run

    codesign
    to dump its entitlements:
    $ codesign -d --entitlements :- /path/to/your.app

    .

  8. Check that you have the

    com.apple.developer.networking.wifi-info
    entitlement.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"