Tcp connect is working fine on Debug but failed on TestFlight - ios

I am working on a project which is written in Flutter. It's using a rust library to TCP stream connect to a specific address. It's working fine in Android, and debug IOS like this:
TcpStream::connect(master_addr).await?;
However, the problem was when I tried to upload the IOS application to the test flight, it stopped working. I added some entitlements:
<key>com.apple.developer.networking.multicast</key>
<true/>
<key>com.apple.developer.networking.networkextension</key>
<array>
<string>app-proxy-provider</string>
<string>content-filter-provider</string>
<string>dns-proxy</string>
<string>dns-settings</string>
<string>packet-tunnel-provider</string>
</array>
Still, it did not work. I assume that Apple does require some special entitlements for this to work? Any thoughts?

Related

Fetch (or Axios) in react native not working for expo for iOS apps

iOS doesn't allow to navigate to http only url, allowing only https.
There is a solution, which is changing some code inside info.plist file
https://github.com/facebook/react-native/issues/8717
How can I change settings for iOS, as it comes with only .expo folder but nothing else.
Do I need to change server configuration for this at last? :(
As you properly find out, the problem is that iOS do not allow arbitrary calls to non-secure(http only) domains. It was a feature introduced with iOS 9 in order to push developers onto more secured connections.
As per writing of this(mid 2017), there is workaround. You should open
{Your-project}/ios/{Your-project}/Info.plist
and set proper values for the domain you are targeting(docs).
Following example will disable ATS and allow HTTP call to somedomain.com:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
In your situation, I believe you are looking for the Info.plist file in the wrong place. It is not part of the node modules, instead look at the ios path specified above.
Unfortunately Expo doesn't allow you to modify the App Transport Security Settings but may bake in a configuration option. Here's a Github thread.
You can eject from Expo but only do this if you are 100% sure.
This will give you a project very similar to one created by react-native init
This features an ios and android directory, navigating to ios/YourProject/ will reveal Info.plist.
How much of a struggle would it be to install an SSL certificate on your server? It may be more beneficial to do this and you can use a free service like letsencrypt.

iPhone HTTP Request failed by real device

I develop iPhone App which use local rails server for development.
Before the problem, the app could connect to rails server through WiFi.
But, recently the app could not connect to rails server sometimes.
This is the problem I met
1. HTTP Request can not reach to rails server because the rails log do not show nothing.
2. iPhone log show HTTP Request failed because time out.
Environment
1. AFNetworking 3.0.4 I use AFHTTPSessionManager for HTTP Request
2. I user real iPhone devices that are iPhone6s plus iOS 9.2.1, iPhone6 iOS 9.2 and iPhone5s iOS 8.2. All device show same problem.
What I do
1. Changed AFNetworking version 2.6.3 to 3.0.4. But ineffective.
2. Reinstall app. First some times OK. But at a minute same problem occurred.
Anyone know the solution?
I have developed the app for a few months, but recently sudden the problem occurred. I do not know at all why this is happened.
for the http request now you need to add those line in your plist <key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Starting from iOS9 you should provide NSAppTransportSecurity key value in your plist file to use HTTP (not HTTPS):
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33

iOS 9.1 Images and Videos not displaying in app

I have develop one application in which there are so many photos and videos.
I have develop this app in xcode6.3 and it will work perfectly but now i have installed new xcode7.1 and when i'm trying to run this app in xcode7.1 it will run perfectly but i haven't seen any videos and images of my app.
Is that any chnage that i have to do in my code or is it any other problem
Starting from Xcode7 Apple mandates that all url access should be HTTPS as a part of Apple Transport Security (ATS)
To overcome this you have to add the following item in your app info.plist file
You can bypass this by adding this key to your info.plist of the project
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
for more details about ATS refer NSURLSession/NSURLConnection HTTP load failed on iOS 9
http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/

How to toggle torch functionality in iPhone 4 iOS 6 at app start with preferences plist

I'm using an app called "Stickam", which is live audio/video recording and upload over 3G. The app is perfect for my purpose except for lacking LED torch (flashlight) mode. I have a tweak installed which allows me to toggle on torch via settings and leave it on while I use other apps (i.e., Safari, Appstore) but when I start a Stickam broadcast, the torch turns off.
I'm using a file browser on the iPhone with basic text editing and file manipulation ability to examine the iOS file structure and the apps. I don't want to edit Stickam, just override it's setting by pasting in Stickam's
var/mobile/Applications/FA037A73-C483-43D6-8AE8-7E69CD57EBDD/Library/Preferences/.GlobalPreferences.plist, a reference to torch's location and trigger.
Similar to:
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>alternateColors</key>
<true/>
<key>defaults</key>
<string>com.ravirajm.torch</string>
<key>key</key>
<string>torchenabled</string>
<key>label</key>
<string>Enable Torch</string>
<key>PostNotification</key>
<string>com.ravirajm.torch/prefs</string>
</dict>
Doesn't seem like it would work. What ideas do you have on how to do this?
You can't modify another developer's app bundle at all unless the device is jailbroken.

iPhone App Minus App Store?

If I create an application on my Mac, is there any way I can get it to run on an iPhone without going through the app store?
It doesn't matter if the iPhone has to be jailbroken, as long as I can still run an application created using the official SDK. For reasons I won't get into, I can't have this program going through the app store.
Official Developer Program
For a standard iPhone you'll need to pay the US$99/yr to be a member of the developer program. You can then use the adhoc system to install your application onto up to 100 devices. The developer program has the details but it involves adding UUIDs for each of the devices to your application package. UUIDs can be easiest retrieved using Ad Hoc Helper available from the App Store. For further details on this method, see Craig Hockenberry's Beta testing on iPhone 2.0 article
Jailbroken iPhone
For jailbroken iPhones, you can use the following method which I have personally tested using the AccelerometerGraph sample app on iPhone OS 3.0.
Create Self-Signed Certificate
First you'll need to create a self signed certificate and patch your iPhone SDK to allow the use of this certificate:
Launch Keychain Access.app. With no items selected, from the Keychain menu select Certificate Assistant, then Create a Certificate.
Name: iPhone Developer
Certificate Type: Code Signing
Let me override defaults: Yes
Click Continue
Validity: 3650 days
Click Continue
Blank out the Email address field.
Click Continue until complete.
You should see "This root certificate is not trusted". This is expected.
Set the iPhone SDK to allow the self-signed certificate to be used:
sudo /usr/bin/sed -i .bak 's/XCiPhoneOSCodeSignContext/XCCodeSignContext/' /Developer/Platforms/iPhoneOS.platform/Info.plist
If you have Xcode open, restart it for this change to take effect.
Manual Deployment over WiFi
The following steps require openssh, and uikittools to be installed first. Replace jasoniphone.local with the hostname of the target device. Be sure to set your own password on both the mobile and root users after installing SSH.
To manually compile and install your application on the phone as a system app (bypassing Apple's installation system):
Project, Set Active SDK, Device and Set Active Build Configuration, Release.
Compile your project normally (using Build, not Build & Go).
In the build/Release-iphoneos directory you will have an app bundle. Use your preferred method to transfer this to /Applications on the device.
scp -r AccelerometerGraph.app root#jasoniphone:/Applications/
Let SpringBoard know the new application has been installed:
ssh mobile#jasoniphone.local uicache
This only has to be done when you add or remove applications. Updated applications just need to be relaunched.
To make life easier for yourself during development, you can setup SSH key authentication and add these extra steps as a custom build step in your project.
Note that if you wish to remove the application later you cannot do so via the standard SpringBoard interface and you'll need to use SSH and update the SpringBoard:
ssh root#jasoniphone.local rm -r /Applications/AccelerometerGraph.app &&
ssh mobile#jasoniphone.local uicache
Yes, once you have joined the iPhone Developer Program, and paid Apple $99, you can provision your applications on up to 100 iOS devices.
Build your app
Upload to a crack site
(If you app is good enough) the crack version will be posted minutes later and ready for everyone to download ;-)
With the help of this post, I have made a script that will install via the app Installous for rapid deployment:
# compress application.
/bin/mkdir -p $CONFIGURATION_BUILD_DIR/Payload
/bin/cp -R $CONFIGURATION_BUILD_DIR/MyApp.app $CONFIGURATION_BUILD_DIR/Payload
/bin/cp iTunesCrap/logo_itunes.png $CONFIGURATION_BUILD_DIR/iTunesArtwork
/bin/cp iTunesCrap/iTunesMetadata.plist $CONFIGURATION_BUILD_DIR/iTunesMetadata.plist
cd $CONFIGURATION_BUILD_DIR
# zip up the HelloWorld directory
/usr/bin/zip -r MyApp.ipa Payload iTunesArtwork iTunesMetadata.plist
What Is missing in the post referenced above, is the iTunesMetadata. Without this, Installous will not install apps correctly. Here is an example of an iTunesMetadata:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>appleId</key>
<string></string>
<key>artistId</key>
<integer>0</integer>
<key>artistName</key>
<string>MYCOMPANY</string>
<key>buy-only</key>
<true/>
<key>buyParams</key>
<string></string>
<key>copyright</key>
<string></string>
<key>drmVersionNumber</key>
<integer>0</integer>
<key>fileExtension</key>
<string>.app</string>
<key>genre</key>
<string></string>
<key>genreId</key>
<integer>0</integer>
<key>itemId</key>
<integer>0</integer>
<key>itemName</key>
<string>MYAPP</string>
<key>kind</key>
<string>software</string>
<key>playlistArtistName</key>
<string>MYCOMPANY</string>
<key>playlistName</key>
<string>MYAPP</string>
<key>price</key>
<integer>0</integer>
<key>priceDisplay</key>
<string>nil</string>
<key>rating</key>
<dict>
<key>content</key>
<string></string>
<key>label</key>
<string>4+</string>
<key>rank</key>
<integer>100</integer>
<key>system</key>
<string>itunes-games</string>
</dict>
<key>releaseDate</key>
<string>Sunday, December 12, 2010</string>
<key>s</key>
<integer>143441</integer>
<key>softwareIcon57x57URL</key>
<string></string>
<key>softwareIconNeedsShine</key>
<false/>
<key>softwareSupportedDeviceIds</key>
<array>
<integer>1</integer>
</array>
<key>softwareVersionBundleId</key>
<string>com.mycompany.myapp</string>
<key>softwareVersionExternalIdentifier</key>
<integer>0</integer>
<key>softwareVersionExternalIdentifiers</key>
<array>
<integer>1466803</integer>
<integer>1529132</integer>
<integer>1602608</integer>
<integer>1651681</integer>
<integer>1750461</integer>
<integer>1930253</integer>
<integer>1961532</integer>
<integer>1973932</integer>
<integer>2026202</integer>
<integer>2526384</integer>
<integer>2641622</integer>
<integer>2703653</integer>
</array>
<key>vendorId</key>
<integer>0</integer>
<key>versionRestrictions</key>
<integer>0</integer>
</dict>
</plist>
Obviously, replace all instances of MyApp with the name of your app and MyCompany with the name of your company.
Basically, this will install on any jailbroken device with Installous installed. After it is set up, this results in very fast deployment, as it can be installed from anywhere, just upload it to your companies website, and download the file directly to the device, and copy / move it to ~/Documents/Installous/Downloads.
With the upcoming Xcode 7 it's now possible to install apps on your devices without an apple developer license, so now it is possible to skip the app store and you don't have to jailbreak your device.
Now everyone can get their app on their Apple device.
Xcode 7 and
Swift now make it easier for everyone to build apps and run them
directly on their Apple devices. Simply sign in with your Apple ID,
and turn your idea into an app that you can touch on your iPad,
iPhone, or Apple Watch. Download Xcode 7 beta and try it yourself
today. Program membership is not required.
Quoted from: https://developer.apple.com/xcode/
Update:
XCode 7 is now released:
Free On-Device Development
Now everyone can run and test their own app
on a device—for free. You can run and debug your own creations on a
Mac, iPhone, iPad, iPod touch, or Apple Watch without any fees, and no
programs to join. All you need to do is enter your free Apple ID into
Xcode. You can even use the same Apple ID you already use for the App
Store or iTunes. Once you’ve perfected your app the Apple Developer
Program can help you get it on the App Store.
See Launching Your App on Devices for detailed information about
installing and running on devices.
It's worth noting that if you go the jailbroken route, it's possible (likely?) that an iPhone OS update would kill your ability to run these apps. I'd go the official route and pay the $99 to get authorized. In addition to not having to worry about your apps being clobbered, you also get the opportunity (should you choose) to release your apps on the store.
After copying the the app to the iPhone in the way described by #Jason Weathered, make sure to "chmod +x" of the app, otherwise it won't run.
*Changes/Notes to make this work for Xcode 3.2.1 and iPhone SDK 3.1.2
Manual Deployment over WiFi
2) Be sure to restart Xcode after modifying the Info.plist
3) The "uicache" command is not found, using killall -HUP SpringBoard worked fine for me.
Other then that, I can confirm this works fine.
Mac users, using PwnageTool 3.1.4 worked great for Jailbreaking (DL via torrent).
If you patch /Developer/Platforms/iPhoneOS.platform/Info.plist and then try to debug a application running on the device using a real development provisionen profile from Apple it will probably not work. Symptoms are weird error messages from com.apple.debugserver and that you can use any bundle identifier without getting a error when building in Xcode. The solution is to restore Info.plist.

Resources