What is the purpose of libParallelCompression in iOS? - ios

I do data compresssion with libcompression.tbd, which was introduced
in iOS 9.0. There appeared libParallelCompression.tbd in iOS 11.0. But I can't find any information about it, and library header looks like that:
symbols: [ _BXDiff5, _BXPatch5, _BXPatch5InPlace, _BXPatchFile, _CachePatch,
_DirectoryDiff, _DirectoryPatch, _ISparseArchiveStreamCreate,
_ISparseArchiveStreamDestroy, _ISparseArchiveStreamRead, _PCompressFilter,
_PackagePatch, _ParallelArchiveExtract, _ParallelArchiveGenerateBOM,
_ParallelArchiveGenerateMSUBOM
...
I have strong suspicion that libParallelCompression is for audio processing.
How to detect the purpose of libParallelCompression.tbd?
Do you know compression libs for iOS, faster that libcompression.tbd?

Related

runtime/cgo: could not obtain pthread_keys Simulator Error

I ran into this issue with Xcode 12.1 simulators running iOS 14.1. My code does compiles then I get the runtime error of
runtime/cgo: could not obtain pthread_keys
tried 0x118 0x119 0x11a 0x11b 0x11c 0x11d 0x11e 0x11f 0x120 0x121 0x122 0x123 0x124 0x125 0x126 0x127 0x128 0x129 0x12a 0x12b 0x12c 0x12d 0x12e 0x12f 0x130 0x131 0x132 0x133 0x134 0x135 0x136 0x137 0x138 0x139 0x13a 0x13b 0x13c 0x13d 0x13e 0x13f 0x140 0x141 0x142 0x143 0x144 0x145 0x146 0x147 0x148 0x149 0x14a 0x14b 0x14c 0x14d 0x14e 0x14f 0x150 0x151 0x152 0x153 0x154 0x155 0x156 0x157 0x158 0x159 0x15a 0x15b 0x15c 0x15d 0x15e 0x15f 0x160 0x161 0x162 0x163 0x164 0x165 0x166 0x167 0x168 0x169 0x16a 0x16b 0x16c 0x16d 0x16e 0x16f 0x170 0x171 0x172 0x173 0x174 0x175 0x176 0x177 0x178 0x179 0x17a 0x17b 0x17c 0x17d 0x17e 0x17f 0x180 0x181 0x182 0x183 0x184 0x185 0x186 0x187 0x188 0x189 0x18a 0x18b 0x18c 0x18d 0x18e 0x18f 0x190 0x191 0x192 0x193 0x194 0x195 0x196 0x197
The code runs fine on the iOS 13.5 simulators as well as on a physical device running iOS 14. I would like to have the simulators running and working. Does anyone have a solution for this issue to work on iOS 14 simulators? And if anyone might know if this issue would affect Apple Store submissions
I am assuming you are using a go library framework file with your iOS Project. We had a similar issue with our codebase. To answer your questions:
It won't affect Apple Store submissions/releases on the App Store - we have made few releases in the last few months and there have been no issues.
Regarding the issue itself, I assume this is because of the go version - you have not stated what go version you are using but this was prevalent if you were using an older version (1.10.x or previous).
Updating your go lib version to a newer release and building your framework file with that version should solve your problem
I haven't understood much on why the issue occurs but here's an answer that tries to explain something similar

Cross platform code sharing in Swift

I have an app created from Xcode 9 / New Project / Cross Platform Game App, targets: macOS and iOS.
I wrote the following simple function to load text from a Data Asset.
func dataAssetAsString(_ name: String) -> String? {
if let asset = NSDataAsset(name: NSDataAsset.Name(name)) {
return String(data: asset.data, encoding: .utf8)
}
return nil
}
I'm puzzled by the following things:
This function only works if I import either UIKit, or AppKit.
But somehow importing MetalKit instead of UIKIt or AppKit makes it work. This really puzzles me. This should have nothing to do with MetalKit.
Most answers I found for code sharing between iOS and macOS suggest some kind of conditional import at the beginning of the file / shimming.
I went through the slides of WWDC 2014 Session 233: Sharing code between iOS and OS X, and it explicitly says we should not do shimming in Swift.
On the other hand, I don't understand what we should do instead of shimming. The mentioned very complicated process of creating and compiling shared frameworks for a 5 line function cannot be the right direction.
In 2018 (Swift 4, Xcode 9, iOS 11, macOS 10.13), what would be the recommended way to add such a trivial cross platform code to an app?
What is the magic of MetalKit which makes it work without shimming? Does it shim internally?

Does Enabling the Bit Code will decrease the original size of Unity IOS build

I have been going through different posts regarding Bit Code option introduced in XCode. As i am creating a project in unity trying to reduce the over the air build size. According to most of the bit code post related to unity they ending up disabling it. my questions are
If i enable the bit code for unity project i know the addition bit
code data will be stripped but does it will decrease the orignal size
of Over-the-air build as right now i have an estimate universal
Download size is 125 MB and i want it to be less then 100MB?
Can i disable the bit code for a specific framework but enable for
project?
Unity Version : 5.3.5f1t
XCode : 7.2
Thanks
As stated here
, bit code is specifically for App Store submission. And extra data will be stripped by App Store only. So I guess in all other cases like ad-hoc/OTA it will not reduce build size.
For your other question, you can use PostProcessing to change these settings.
Here is an example:
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.Collections;
using UnityEditor.iOS.Xcode;
using System.IO;
public class BL_BuildPostProcess
{
[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
{
if (buildTarget == BuildTarget.iOS)
{
string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
PBXProject proj = new PBXProject();
proj.ReadFromString(File.ReadAllText(projPath));
string target = proj.TargetGuidByName("Unity-iPhone");
proj.SetBuildProperty(target, "ENABLE_BITCODE", "false");
File.WriteAllText(projPath, proj.WriteToString());
}
}
}
Other references:
IL2CPP Build Size Optimizations
Bitcode Support In IOS & TvOS
hope it helps :)

iswalpha() in iOS doesn't return the same value on iOS that it does on MacOS

I have a problem about iswalpha() on iOS.
I am tuning my app in Xcode 4.5 and I tried to pass the Spanish character ú to iswalpha(). The xcode displays the int value of ú is 250.
When I tried to run the app on a real device, iswalpha() returns 0; but in the simulator (I run Xcode on a MacBook air with 10.8.2) it returns 1.
I guess the reason might be iOS has a different implementation of wide-character than does MacOS. What is the best way to resolve this?
Enhanced details:
UTF-16(unicode)encoding of Spanish character ú is 250 in int value. I think iswalpha()should return 1, as MACOS does, other than in iOS return a 0.
Dam new user could not post image here. so for UTF-16 encoding of ú please refer to :
http://www.fileformat.info/info/unicode/char/fa/index.htm
Well I can answer my own question now, as well as a development log in case I forgot this later:
It seems to be a fault of Apple's implementation of libc in iOS. The implementation of iswalpha() is incomplete considering letters in languages other than English. The specific letters(ú,á,ó,...) in different languages could not be recognized by iswalpha(), because they fall out of the 0x7F ASCII boundry, and for somehow it could not be recognized by iOS's locale processing functions, but obviously in different locale those should still be readable alphabet letters.
Some details about it:
iswalph() in iOS is tracked down to:
__DARWIN_CTYPE_static_inline int
__istype(__darwin_ct_rune_t _c, unsigned long _f)
{
#ifdef USE_ASCII
return !!(__maskrune(_c, _f));
#else /* USE_ASCII */
return (isascii(_c) ? !!(_DefaultRuneLocale.__runetype[_c] & _f)
: !!__maskrune(_c, _f));
#endif /* USE_ASCII */
}
and it is __maskrune(_c, _f)) that in the end returns 0.
It is understandable that Apple missed this point since, nobody will use iswalpha() in Objective-C. However it may still be useful to note this point for some porting projects. It was a widely used function so maybe important to many legacy projects that porting to iOS. Hope Apple could fix it in later release.
My workaround now to this problem is to have a wrapper function of iswalpha(), which handle these Latin letters by my own code. Now the app runs flawlessly in my iPhone!

"dyld: Symbol not found:" for iOS 6-exclusive class in Static Library

NOTE: Yes, I know iOS 6 is under NDA. This question has nothing to do with iOS 6, expect for the fact that the class that I'm referencing is new in iOS 6.
I'm creating a static framework for use in several of my projects, which allows me to use a new API in iOS 6 if it's available, and if it's not it'll fall back to an iOS 5 equivalent. However, although I make sure to always check if a class is valid before using it like so:
if ([NewClass class]) {
NewClass *newClass = [[NewClass alloc] init];
// etc.
}
Whenever I launch my app in the iOS 5 Simulator, I get the following error:
dyld: Symbol not found: _OBJC_CLASS_$_NewClass
(where NewClass stands for the iOS 6 class).
This seems to be an issue just with using a static library, as if I include the certain files that reference the API directly in my project and reference them, it will launch with no issues. I've even tried weak-linking the static library, and it still crashes. The only option that works is weak-linking UIKit, but I would prefer to not have to do that due to UIKit being quite a large framework, and weak-linking takes extra time.
So basically, what can I do to weak link this class in the static library itself?
I guess your IPHONEOS_DEPLOYMENT_TARGET is not set to iOS 5? I just had the same error, because it was already on iOS 6. After setting it to iOS 5, everything was fine.
You can find the configuration both under Target->BuildSettings->IPHONEOS_DEPLOYMENT_TARGET and under Target->Summary->iOS Application Target.
Another approach to avoid this kind of error would be this:
Class myClass = NSClassFromString(#"NewClass")
if( myClass ) {
NSObject *myResult = [myClass aMethod:#"Hello World"];
}

Resources